我有一个服务页面,它显示服务详细信息,并有一个像服务功能和费用这样的子部分。我为功能和费用创建了两个中继器。有关详细信息,请参阅以下 sql 表图像:
但我不知道如何将此分层数据绑定到嵌套中继器。这是我的代码:
<!--Nested Repeater Section-->
<asp:Repeater ID="ServiceDetailsRepeater" runat="server"
onitemdatabound="ServiceDetailsRepeater_ItemDataBound">
<ItemTemplate>
<asp:HiddenField ID="service_id" runat="server" Value='<%#Eval("Id")%>'/>
<h3><a name='<%#Eval("Id")%>'></a><%#Eval("Service_name")%></h3>
<img src='<%# "images/"+ Eval("ImageName")%>' alt="picture" width="48" height="48" class="img" />
<p><%#Eval("Service_desc")%></p>
<div id="Div1" class="clr" runat="server"> </div>
<div id="Div2" class="box" runat="server">
<div id="Div3" class="box_t" runat="server">
<asp:Panel ID="Panel_ServiceFeature" runat="server" class="box_b">
<h2>Features</h2>
<ul style="font-family:Arial, Helvetica, sans-serif;font-size:11px;color:#5f5f5f">
<asp:Repeater ID="ServiceFeatureRepeater" runat="server">
<ItemTemplate>
<li><%#Eval("Feature_Text")%></li>
</ItemTemplate>
</asp:Repeater>
</ul>
</asp:Panel>
</div>
</div>
<div id="Div5" class="clr" runat="server"> </div>
<div id="Div6" class="box" runat="server">
<div id="Div7" class="box_t" runat="server">
<asp:Panel ID="Panel_ServiceCharge" runat="server" class="box_b">
<h2>Charges</h2>
<table style="font-family:Arial, Helvetica, sans-serif;font-size:11px;color:#5f5f5f">
<tr><td></td>
<td>Rs.</td><td> </td><td align="left">Months</td></tr>
<asp:Repeater ID="ServiceChargeRepeater" runat="server">
<ItemTemplate>
<tr>
<td><img src="images/sub_nav.gif" width="18px" height="14px" alt=""/></td>
<td>Rs. <%#String.Format("{0:#,###}", Eval("Charges_Per_Month"))%></td>
<td> </td>
<td><%#Eval("No_Of_Month")%> Months</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</asp:Panel>
</div>
</div>
<div id="Div9" class="clr" runat="server"></div>
</ItemTemplate>
</asp:Repeater>
<!--End Section-->
最后,我的网站页面,这是我的实时网站服务页面视图。此页面是静态的,但现在我想将此服务详细信息与数据库绑定。