control to show details -
in the aspx page -
<asp:GridView ID="studentGridView" runat="server" AutoGenerateColumns="False"
AutoGenerateSelectButton="True" DataKeyNames="Id"
onselectedindexchanged="studentGridView_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Student Id" />
<asp:BoundField DataField="Name" HeaderText="Student Name" />
</Columns>
</asp:GridView>
<br />
<br />
<asp:DetailsView ID="studentDetailsView" runat="server"
AutoGenerateRows="False" Height="50px" Width="125px">
<Fields>
<asp:BoundField DataField="Id" HeaderText="Id" />
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:BoundField DataField="Address" HeaderText="Address" />
</Fields>
</asp:DetailsView>
use code behind file to populate GridView from database,
then include the following codes to show details for each
item using detailsview -
protected void studentGridView_SelectedIndexChanged(object sender, EventArgs e)
{
int id = Convert.ToInt16(studentGridView.SelectedValue);
//get details on id from database
students = studentGateway.GetStudent(id);
studentDetailsView.DataSource = students;
studentDetailsView.DataBind();