Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. binding the data to the grid

binding the data to the grid

Scheduled Pinned Locked Moved C#
csswpfwcftutorial
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chithra r
    wrote on last edited by
    #1

    hi all iam having a grid in my application which has 4 columns of which 1 column i set visible=false.i want to bind the value of that column to the textbox.since the bound column is not visible the data is not coming in the textbox.can anyone tell me how to bind the data.

    pintoo

    T 1 Reply Last reply
    0
    • C chithra r

      hi all iam having a grid in my application which has 4 columns of which 1 column i set visible=false.i want to bind the value of that column to the textbox.since the bound column is not visible the data is not coming in the textbox.can anyone tell me how to bind the data.

      pintoo

      T Offline
      T Offline
      Thats Aragon
      wrote on last edited by
      #2

      Hi Chithra! You must have some DataSource to bind a Grid. So directly set that column value to the TextBox. Suppose you have DataTable as DataSource then try this. DataTable dt = new DataTable(); if(dt!=null) { if(dt.Rows.Count>0) { TextBox1.Text = dt.Rows[0][4].ToString(); YourGrid.DataSource = dt; YourGrid.DataBind(); } } I hope this will help you. :) Regards..

      "Save water,It's precious" :)

      C 1 Reply Last reply
      0
      • T Thats Aragon

        Hi Chithra! You must have some DataSource to bind a Grid. So directly set that column value to the TextBox. Suppose you have DataTable as DataSource then try this. DataTable dt = new DataTable(); if(dt!=null) { if(dt.Rows.Count>0) { TextBox1.Text = dt.Rows[0][4].ToString(); YourGrid.DataSource = dt; YourGrid.DataBind(); } } I hope this will help you. :) Regards..

        "Save water,It's precious" :)

        C Offline
        C Offline
        chithra r
        wrote on last edited by
        #3

        hi thanx for the reply.but i have binded the data already.i want to retrieve the data from the gridview but not from the data table directly(data is present in the grid but the visible property is set to false.)i want to retrieve the data from the grid.

        pintoo

        T 1 Reply Last reply
        0
        • C chithra r

          hi thanx for the reply.but i have binded the data already.i want to retrieve the data from the gridview but not from the data table directly(data is present in the grid but the visible property is set to false.)i want to retrieve the data from the grid.

          pintoo

          T Offline
          T Offline
          Thats Aragon
          wrote on last edited by
          #4

          Hi Chithra! Where is your TextBox resides? Inner side or outer side of GridView?

          "Save water,It's precious" :)

          C 2 Replies Last reply
          0
          • T Thats Aragon

            Hi Chithra! Where is your TextBox resides? Inner side or outer side of GridView?

            "Save water,It's precious" :)

            C Offline
            C Offline
            chithra r
            wrote on last edited by
            #5

            hey i got it..the text box was outside the grid only..actually i used a html input field and made that field in the grid hidden..iam giving the code here which i used. and to retrieve the value txt1.Text = ((HtmlInputHidden)GvPromotion.Rows[e.NewEditIndex].FindControl("DescHiddenValue")).Value;

            pintoo

            1 Reply Last reply
            0
            • T Thats Aragon

              Hi Chithra! Where is your TextBox resides? Inner side or outer side of GridView?

              "Save water,It's precious" :)

              C Offline
              C Offline
              chithra r
              wrote on last edited by
              #6

              hey i got it..the text box was outside the grid only..actually i used a html input field and made that field in the grid hidden..iam giving the code here which i used. and to retrieve the value txt1.Text = ((HtmlInputHidden)GvPromotion.Rows[e.NewEditIndex].FindControl("DescHiddenValue")).Value; anyway thanx for sparing your time..

              pintoo

              T 1 Reply Last reply
              0
              • C chithra r

                hey i got it..the text box was outside the grid only..actually i used a html input field and made that field in the grid hidden..iam giving the code here which i used. and to retrieve the value txt1.Text = ((HtmlInputHidden)GvPromotion.Rows[e.NewEditIndex].FindControl("DescHiddenValue")).Value; anyway thanx for sparing your time..

                pintoo

                T Offline
                T Offline
                Thats Aragon
                wrote on last edited by
                #7

                You are Welcome!...... :)

                "Save water,It's precious" :)

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups