Save-all funktion i nested repeater
Hej.Er der en der kan gennemskue hvordan jeg kan lave en "gem alle" funktion i min nested repeater?
aspx:
<asp:Repeater ID="repeaterParent" runat="server" OnItemCommand="SaveAll">
<ItemTemplate>
<b>OrderId: <%# Eval("OrderID")%></b> <br />
<asp:Repeater ID="repeaterChild" runat="server" datasource='<%# ((DataRowView)Container.DataItem).Row.GetChildRows("myrelation") %>' OnItemCommand="SaveSingle">
<ItemTemplate>
<table width="100%">
<tr>
<td> <%# Eval("[\"ProductName\"]")%></td>
<td align="right">
DeliverDate: <asp:TextBox ID="DeliverDate" Text='<%# Eval("[\"ProductName\"]")%>' runat="server" />
<asp:Button ID="SaveSingle" CommandName="SaveSingle" CommandArgument='<%# Eval("[\"ID\"]")%>' Text="Save" runat="server" />
</td>
</tr>
</table>
</ItemTemplate>
<FooterTemplate>
<hr />
</FooterTemplate>
</asp:Repeater>
</ItemTemplate>
<FooterTemplate><div style="text-align:right"><asp:Button ID="SaveALL" CommandName="SaveALL" runat="server" Text="Save all" /></div></FooterTemplate>
</asp:Repeater>
in .cs:
This works fine:
protected void SaveSingle(object sender, RepeaterCommandEventArgs e)
{
int OrderLineID = Convert.ToInt32(e.CommandArgument);
TextBox DeliverDate = (TextBox)e.Item.FindControl("DeliverDate");
Response.Write(OrderLineID.ToString() + ": " + DeliverDate.Text);
}
In this i want to grab every item in the repeater:
protected void SaveAll(object sender, RepeaterCommandEventArgs e)
{
foreach (RepeaterItem item in repeaterParent.Items)
{
???
}
}