Hi. Could someone point me to or show me an example of how to add user controls to a RadListView in code behind please.
I have defined the RadListView in the aspx page. In the code behind I create a DataTable containing ID numbers. Next, I loop through these numbers and for each one instantiate two user controls, rebind the user controls, and then add them to the RadListView.
I have the logic to do all of this except I cannot seem to figure out how to add the user controls to the RadListView. No editing/changes will be made to the user controls, I just need to display a horizontal list of the controls for informational purposes.
Here's the aspx code:
Here's the code behind:
Any help would be greatly appreciated.
Thanks!
I have defined the RadListView in the aspx page. In the code behind I create a DataTable containing ID numbers. Next, I loop through these numbers and for each one instantiate two user controls, rebind the user controls, and then add them to the RadListView.
I have the logic to do all of this except I cannot seem to figure out how to add the user controls to the RadListView. No editing/changes will be made to the user controls, I just need to display a horizontal list of the controls for informational purposes.
Here's the aspx code:
<asp:Panel ID="rpItem" runat="server" Scrolling="Y"><telerik:RadListView ID="RadListView1" runat="server" DataKeyNames="iItemID, iSecID" ItemPlaceholderID="ItemPlaceHolder1" AllowPaging="true" Skin="Windows7" PageSize="1" Height="325px" > <LayoutTemplate> <asp:Panel ID="ItemPlaceHolder1" runat="server" Height="300px"> </asp:Panel> </LayoutTemplate> <ItemTemplate> </ItemTemplate> </telerik:RadListView></asp:Panel>Here's the code behind:
Dim tblItemIDs As DataTable = GetItemIDs()For Each r As DataRow In tblItemIDs.Rows Me.hfItem.Value = r("iItemID") Dim ucItemInfo As UserControl = Page.LoadControl("/controls/iItem_Info.ascx") Dim infoView As RadListView = DirectCast(ucItemInfo.FindControl("RadListView1"), RadListView) infoView.Rebind() 'Need to add the ucItemInfo user control Dim ucItemPreview As UserControl = Page.LoadControl("/controls/iItem_Preview.ascx") Dim listView As RadListView = DirectCast(ucItemPreview.FindControl("RadListView1"), RadListView) listView.Rebind() 'Need to add the ucItemPreview user control RadListView1.DataBind()NextAny help would be greatly appreciated.
Thanks!