How to get the cell index of gridview in the event selectindexchanged?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yoyocam
    New Member
    • Mar 2010
    • 3

    How to get the cell index of gridview in the event selectindexchanged?

    Dear my buddy,

    Does anyone know how to get the cell index of gridview in the event selectindexchan ged?

    Regards,
    Nimol
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    The GridView's SelectedIndexCh anged Event is fired when the user selects a Row in a GridView....

    You can use this row to retrieve a specific cell if you need to.

    I'm not sure if this answers your question, if it doesn't please explain what you are trying to do in more detail so that we can help you further.

    -Frinny

    Comment

    • yoyocam
      New Member
      • Mar 2010
      • 3

      #3
      so how can use this row to retrieve a specific cell ??

      Comment

      • liawcv
        New Member
        • Jan 2009
        • 33

        #4
        If what you want is simply the text displayed within a particular cell, the following may work:

        GridView1.Selec tedRow.Cells[3].Text

        Where the "3" is the index of the cell. Simply, 1st cell index 0, 2nd cell index 1, and so on. The code above will not work if you are using more complex column e.g. TemplateField, etc.

        For TemplateField, using FindControl(".. .") method e.g.

        GridView1.Selec tedRow.FindCont rol("Control_ID ")

        Comment

        • yoyocam
          New Member
          • Mar 2010
          • 3

          #5
          yes,if we use code below it will works..but i dun meant that..what i want is when user click any culumn it's will get the index..not select the specific like this code below.

          GridView1.Selec tedRow.Cells[3].Text

          Comment

          Working...