I have a grid that when in edit and insert mode uses a FromTemplate. In that template I want to have a tree view that has checkboxes. The items will load from a SQL data source, but how do I take a column when in edit mode and check the appropriate boxes based on an array item.
My database column is named "banned_sources" and will have a value like so:
Either "0" for no banned sources, or a string like "5,61,64,91,137,139,161"
The numbers in the array match the "source_id" of my datasource. How do select the matches in my tree view if they are present in the array?
ASPX code:
| <td> |
| Banned Lead Sources:</td> |
| <td> |
| <asp:SqlDataSource ID="sqlds_affiliates" runat="server" |
| ConnectionString="<%$ ConnectionStrings:Master_ConnectionString %>" |
| SelectCommand="SELECT [source_id], (CAST([source_id] AS VarChar) + ' ' + [affiliate_name]) AS AffiliateName FROM [lead_affiliates] ORDER BY [source_id]"> |
| </asp:SqlDataSource> |
| <telerik:RadTreeView ID="tree_banned_sources" Runat="server" |
| AppendDataBoundItems="True" CheckBoxes="True" |
| DataSourceID="sqlds_affiliates" DataTextField="AffiliateName" |
| DataValueField="source_id" MultipleSelect="True"> |
| <CollapseAnimation Duration="100" Type="OutQuint" /> |
| <ExpandAnimation Duration="100" /> |
| </telerik:RadTreeView> |
| </td> |