<asp:HiddenField ID="hfOrderState" Value="1" runat="server" />
<asp:SqlDataSource ID="ReadyOrders" runat="server" EnableCaching="true"
DataSourceMode="DataSet" CacheDuration="20"
ConnectionString="<%$ ConnectionStrings:XactCoffeeConnectionString %>"
SelectCommand="SELECT [Orders].* ,[Tables].table_name
FROM [Orders] , [Tables]
WHERE order_state = @order_state
AND [Orders].table_id = [Tables].table_id">
<SelectParameters>
<asp:ControlParameter ControlID="hfOrderState" Name="order_state"
PropertyName="Value" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<div id="xx" runat="server" class="sidePanel"
style="position: fixed; width: 57px; right: 0px; top: 15px; height: 100%; background-color: #00FF00; background-image: none;">
<p>
جاهز
</p>
<asp:Repeater ID="Repeater1" DataSourceID="ReadyOrders" runat="server">
<ItemTemplate>
<asp:HiddenField ID="OrderId" Value='<%# Eval("order_id") %>' runat="server"></asp:HiddenField>
<asp:SqlDataSource ID="sqlOrderItems" runat="server"
EnableCaching="true" DataSourceMode="DataSet" CacheDuration="20"
ConnectionString="<%$ ConnectionStrings:XactCoffeeConnectionString %>"
SelectCommand="GetOrderItems" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="OrderId" Name="order_id"
PropertyName="Value" Type="Int64" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<table id="tbOrders" visible="false">
<thead>
<asp:HiddenField ID="hfOrderId" Value ='<%# Eval("order_id") %>' runat="server" />
<asp:Button ID="Button1" CssClass ="OrderButton" OnClick="b_click" runat="server" Text='<%# Eval("table_name") %>' />
</thead>
<asp:Repeater ID="Repeater1" DataSourceID="sqlOrderItems" runat="server" >
<ItemTemplate>
<tr><td>
<%# Eval("item_name") %>
</td></tr>
</ItemTemplate>
</asp:Repeater>
</table>
<br />
</ItemTemplate>
</asp:Repeater>
如何访问名为sqlDataSource
的子sqlOrderItems
以便在Button1点击事件中重新绑定它?我成功访问了名为sqlDataSource
的父ReadyOrders
,在后面的代码中我可以调用ReadyOrders.DataBind();
另外,我想说明sqlDataSource
名为sqlOrderItems
的孩子取决于名为sqlDataSource
的父ReadyOrders
,但很明显,当绑定父母时,其中没有任何变化页面知道数据库中的数据已更改