GridView problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aj123
    New Member
    • Mar 2007
    • 8

    GridView problem

    Hello;
    I added gridView to web page and dataSource is table stored in database
    I I have cloumn in table of database type bit
    so in gridView convert this coulm to templateFeild
    then i make some change in this feild
    -autopostback=tr ue
    -enable=true
    and I want when user chech the checkbox change the value in databse
    I have tried the following to get the datakey of gridView

    [code=c]
    protected void CheckBox1_Check edChanged(objec t sender, EventArgs e)
    {


    System.Web.UI.W ebControls.Grid ViewCommandEven tArgs Erg = (System.Web.UI. WebControls.Gri dViewCommandEve ntArgs)e;

    Response.Write( Erg.ToString()) ;
    Response.Write (String)Erg.Com mandName);
    }
    [/code]
    but nothing change in web page posting without reuslt
    ?????
    any suggestion
  • shweta123
    Recognized Expert Contributor
    • Nov 2006
    • 692

    #2
    Hi,

    You can get the Datakeys using,

    GridView1.DataK eys[index].Value.ToString ()

    Comment

    • aj123
      New Member
      • Mar 2007
      • 8

      #3
      Originally posted by shweta123
      Hi,

      You can get the Datakeys using,

      GridView1.DataK eys[index].Value.ToString ()
      ............
      hi
      how can i get the index ???
      that importent thing;
      i want to know which row that checkbox is click in so i can get the datakeys


      thanks

      Comment

      • shweta123
        Recognized Expert Contributor
        • Nov 2006
        • 692

        #4
        Hi,

        Can you please refer this Thread
        to get the index of the selected row



        Originally posted by aj123
        ............
        hi
        how can i get the index ???
        that importent thing;
        i want to know which row that checkbox is click in so i can get the datakeys


        thanks

        Comment

        Working...