我可以在转发器控件中放置一个asp:datalist,并在每次重复时对其进行数据绑定吗?使用VB.NET btw ..
干杯! --Jonesy
答案 0 :(得分:2)
步骤:
1.将DataList嵌入中继器中
2.在Repeater的ItemDataBound事件期间绑定每个重复的Datalist
3.如果不需要,请关闭ViewStates。
<强>更新强>
即
脚本方:
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<asp:DataList ID="DataList1" runat="server">
</asp:DataList>
</ItemTemplate>
</asp:Repeater>
代码:
Protected Sub Repeater1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater1.ItemDataBound
Dim DataList1 As DataList = DirectCast(e.Item.FindControl("DataList1"), DataList)
...Databind here ....
End Sub