Question:-
I have a link button bound to my gridview. On clicking the link button, I need to fetch the other column values for the selected row in the codebehind. How do get the gridview values for the selected row on link button click?
Answer:-
I have a link button bound to my gridview. On clicking the link button, I need to fetch the other column values for the selected row in the codebehind. How do get the gridview values for the selected row on link button click?
Answer:-
protected void LinkButton1_Click(object sender, EventArgs e) { LinkButton lb = (LinkButton)sender; GridViewRow row = (GridViewRow)lb.NamingContainer; if (row != null) { int index = row.RowIndex; //gets the row index selected
string ID = grd.Rows[index].cells[cellcount].Text;
} }
Reference
http://forums.asp.net/t/1880980.aspx/1
No comments:
Post a Comment