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..
Csharp code selected record in the grid view to be displayed in the detail view
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

ShankeyRank #972 · 2.1K reputationPosted Nov 16, 2010, 4:25 AM EST
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