I am having some challenges trying to embed a RadGrid within a RadListBox. Do I have to do a FindControl with OnItemDatabound? Or can I do it on Page_Load()? Any help or point me in the right direction would be greatly appreciated.
CODE BEHIND using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Telerik.Web.UI; namespace PortalWeb.Partners.Communications { public class Person { public int RecipientID; public string RecipientName; public string RecipientType; public string CompanyName; public string ProgramName; public Person(int RecipientID, string RecipientName, string RecipientType, string CompanyName, string ProgramName) { this.RecipientID = RecipientID; this.RecipientName = RecipientName; this.RecipientType = RecipientType; this.CompanyName = CompanyName; this.ProgramName = ProgramName; } } public partial class recipients : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void RadGrdidRecipientList_Databound(object sender, RadListBoxItemEventArgs e) { // Dummy Data // List<Person> MyData = new List<Person>(); MyData.Add(new Person(1, "John Doe", "OptIn", "FrogJoy", "UIRR")); MyData.Add(new Person(1, "Jane Doe", "OptIn", "YouTube", "TYRR")); MyData.Add(new Person(1, "Jillian Doe", "OptIn", "Intel", "FREE")); MyData.Add(new Person(1, "Happy Joe", "OptIn", "Hello Kitty", "POLG")); MyData.Add(new Person(1, "Rob Crandle", "OptOut", "McDonalds", "NYTH")); RadGrid myFilterGrid = new RadGrid(); myFilterGrid = e.Item.FindControl("RecipientsGrid") as RadGrid; myFilterGrid.DataSource = MyData; myFilterGrid.DataBind(); } } }ASPX PAGE <telerik:RadListBox ID="RecipientFilterList" runat="server" OnItemDataBound="RadGrdidRecipientList_Databound" Width="450px" Height="300px" SelectionMode="Multiple" AllowTransfer="true" TransferToID="RecipientSelectList" AutoPostBackOnTransfer="true" AllowReorder="true" AutoPostBackOnReorder="true" EnableDragAndDrop="true"> <ItemTemplate> <telerik:RadGrid ID="RecipientsGrid" runat="server" AllowFilteringByColumn="True" GroupingSettings-CaseSensitive="false" AllowPaging="True" AllowSorting="True" GridLines="Horizontal" AutoGenerateColumns="false" ShowHeader="true" PageSize="50" MasterTableView-Width="100%"> <HeaderStyle Font-Bold="true" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" ForeColor="#333333" Wrap="False" /> <AlternatingItemStyle BackColor="#EEEEEE" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Wrap="True" /> <MasterTableView AllowFilteringByColumn="True" ItemStyle-Width="100%" NoMasterRecordsText="No Recipients Found" NoDetailRecordsText="No Recipients Found" Visible="true" ShowHeadersWhenNoRecords="true"> <NoRecordsTemplate> <div align="center"> No Recipients Found</div> </NoRecordsTemplate> <Columns> <telerik:GridBoundColumn DataField="RecipientName" HeaderText="Recipients" UniqueName="RecipientName" SortExpression="RecipientName" ShowSortIcon="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="RecipientType" HeaderText="Type" UniqueName="RecipientType" SortExpression="RecipientType" ShowSortIcon="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="CompanyName" SortExpression="CompanyName" HeaderText="Companies" UniqueName="CompanyName" ItemStyle-HorizontalAlign="left" ShowSortIcon="false" HeaderStyle-HorizontalAlign="left" HeaderStyle-Wrap="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ProgramName" HeaderText="Programs" UniqueName="ProgramName" ShowSortIcon="false" ItemStyle-HorizontalAlign="Left" SortExpression="NumberContacts"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="RecipientID" Visible="false"> </telerik:GridBoundColumn> </Columns> </MasterTableView> <ClientSettings AllowColumnsReorder="False" ReorderColumnsOnClient="False"> </ClientSettings> </telerik:RadGrid> </ItemTemplate> </telerik:RadListBox> <telerik:RadListBox ID="RecipientSelectList" runat="server" Width="450px" Height="300px" SelectionMode="Multiple" AllowReorder="true" AutoPostBackOnReorder="true" EnableDragAndDrop="true"> <Items> </Items> </telerik:RadListBox>