I am attempting to build a RadGrid programmatically utilizing GridDropDownColumns. Each GridDropDownColumn will need to be bound to a DataSource object for population. The DataSourceID specified will always throw the error: Cannot find DataSourceControl with ID 'xxx'. Is this an issue with dynamic column creation and binding or is there another way to populate the GridDropDownColumn server-side?
HTML code:
<telerik:RadPageView runat="server" ID="viewXX" /> //Control to load the RadGrid into
<asp:XmlDataSource ID="XmlDataSource1" runat="server">
<Data>
<Items>
<Item Value="Ms" Text="Ms."/>
<Item Value="Dr" Text="Dr."/>
<Item Value="Mrs" Text="Mrs."/>
<Item Value="Mr" Text="Mr."/>
</Items>
</Data>
</asp:XmlDataSource>
C# code:
RadGrid radgrid = new RadGrid();
GridDropDownColumn boundColumnList = new GridDropDownColumn();
boundColumnList.DataSourceID = "XmlDataSource1";
radgrid.MasterTableView.Columns.Add(boundColumnList);
HTML code:
<telerik:RadPageView runat="server" ID="viewXX" /> //Control to load the RadGrid into
<asp:XmlDataSource ID="XmlDataSource1" runat="server">
<Data>
<Items>
<Item Value="Ms" Text="Ms."/>
<Item Value="Dr" Text="Dr."/>
<Item Value="Mrs" Text="Mrs."/>
<Item Value="Mr" Text="Mr."/>
</Items>
</Data>
</asp:XmlDataSource>
C# code:
RadGrid radgrid = new RadGrid();
GridDropDownColumn boundColumnList = new GridDropDownColumn();
boundColumnList.DataSourceID = "XmlDataSource1";
radgrid.MasterTableView.Columns.Add(boundColumnList);