Hi..
Thanks in advance..
Can anyone provide the code (c sharp web application) for selected record in the grid view to be displayed in the detail view below..
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
ShankeyPosted Nov 16, 2010, 9:25 AM
you can use the "SelectedIndexChanged" event of the gridview control to identify the selection change for row and then ahead you can use the "SelectedIndex" property of the gridview control to get the index of the row. Based on the index of the row you can
get the control from the row as shown below
for eg:
protected void gv_SelectedIndexChanged(object sender, EventArgs e)
{
Label lbl = new Label();
lbl =(Label) gv.Rows[gv.SelectedIndex].FindControl("controlname");
// you can use lbl.Text to get the control contet. Depends on control
}
controlname is the name of the control which is used to display data in the row. In above example "controlname" is assumed as label control