c# - How to get the value of a cell specifies the GridView ASP.NET -


i need value of cell of gridview. when user click on grid, need know line button, , value of cell. i'm trying use following code, not work.

 protected void gvsearch_rowcommand(object sender, gridviewcommandeventargs e)     {         if (e.commandname == "select")         {             int row = convert.toint32(e.commandargument);              string tst = gvsearch.rows[row].cells[1].text;         }     } 

i not know if i'm using right event on goal. if can me, thank you.

i found solution!

am using boundfield.

<asp:boundfield headertext="código Área" datafield=" <asp:boundfield headertext="denominação Área" datafield="areaname" />  protected void gvsearch_selectedindexchanged(object sender, eventargs e)     {         string lastname = gvsearch.selectedrow.cells[1].text;     } 

thanks everyone!


Comments