Nesting a DataGrid inside a Repeater

P

PK9

I'm currently using a repeater to display summary information on selected
items a user selects from a combo box on the UI. I now want to add some
detailed information as well using a dataGrid within this repeater. I'm
having trouble setting the DataSource, and binding the dataGrid based on the
primary key from the Repeater.

For example:
In this example, the repeater DataSource has been set and databound in the
code behind. Below is the aspx code that includes the DataGrid I'm having
trouble with. I have some code to pull back a DataSet for this dataGrid
based on the "BookTitle" value from the DataRepeater. The "BookTitle" is the
primary key which I want to return further details for to populate my
DataGrid.
<asp:Repeater ID="repImpactAssessment" Runat="server">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<asp:Table Width="100%" Runat="server" style="border:1px solid black;">
<asp:TableRow>
<asp:TableCell>
Book Title
</asp:TableCell>
<asp:TableCell>
<asp:Label Runat=server Text='<%# DataBinder.Eval(Container.DataItem,
"BookTitle" %>'/>
</asp:TableCell>
</asp:TableRow>
</asp:Table>

<asp:DataGrid runat=server id=dgAccountsWithBookTitles />
</ItemTemplate>
</asp:Repeater>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top