开发者

Can I place a asp:datalist inside a repeater control and databind it?

开发者 https://www.devze.com 2022-12-25 11:10 出处:网络
Can I place a asp:da开发者_C百科talist inside a repeater control and databind it for each time its repeated? Using VB.NET btw..

Can I place a asp:da开发者_C百科talist inside a repeater control and databind it for each time its repeated? Using VB.NET btw..

Cheers! --Jonesy


Steps:
1. Nest the DataList in the Repeater
2. Bind each repeated Datalist during the Repeater's ItemDataBound event
3. Turn off their ViewStates,if they are not required.

Update:

i.e.

Script Side:

<asp:Repeater ID="Repeater1" runat="server">
        <ItemTemplate>
            <asp:DataList ID="DataList1" runat="server">
            </asp:DataList>
        </ItemTemplate>
        </asp:Repeater>

In Code:

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
0

精彩评论

暂无评论...
验证码 换一张
取 消