Hi,
I've got a problem where i'm trying to build a webpart that uses a RadTreeList that nests a RadGrid within the second column of the RadTreeList to give me a hierarchy of grids. This allows me to view a set of grid data at each level of a hierarchy and alter the data within, due to the size of the hierarchies and grids i only want to load the grid data if an item has been selected within a filter control.
I have managed to create my RadTreeList with the nested Grids which loads and add a NeedDataSource to each grid as its being loaded. This will load the initial set of data and i can then trigger the edit on the grids which seems to work OK.
My problem is when i come to deselect a grid from my filter control and then in the Grid NeedDataSource it sets the datasource back to null and in turn i would expect on the loading of the grid the grid shouldn't be displayed as its datasource is empty. However for some reason the grid is still persisting the previously loaded data? Can anyone tell me why this is, have i missed something?
I have posted my HTML/ASP markup and C# code below:
Thanks,
JC
I've got a problem where i'm trying to build a webpart that uses a RadTreeList that nests a RadGrid within the second column of the RadTreeList to give me a hierarchy of grids. This allows me to view a set of grid data at each level of a hierarchy and alter the data within, due to the size of the hierarchies and grids i only want to load the grid data if an item has been selected within a filter control.
I have managed to create my RadTreeList with the nested Grids which loads and add a NeedDataSource to each grid as its being loaded. This will load the initial set of data and i can then trigger the edit on the grids which seems to work OK.
My problem is when i come to deselect a grid from my filter control and then in the Grid NeedDataSource it sets the datasource back to null and in turn i would expect on the loading of the grid the grid shouldn't be displayed as its datasource is empty. However for some reason the grid is still persisting the previously loaded data? Can anyone tell me why this is, have i missed something?
I have posted my HTML/ASP markup and C# code below:
<telerik:RadTreeList ID="rtl_TaxonomyGrids" runat="server" AutoGenerateColumns="False" DataKeyNames="Allocation" ParentDataKeyNames="Parent_Allocation" OnItemDataBound="rtl_TaxonomyGrids_ItemDataBound" OnLoad="rtl_TaxonomyGrids_Load" OnNeedDataSource="rtl_TaxonomyGrids_NeedDataSource" OnItemCreated="rtl_TaxonomyGrids_ItemCreated"> <Columns> <telerik:TreeListBoundColumn UniqueName="Name" DataField="Name" HeaderText="Name"> <HeaderStyle Width="100px"></HeaderStyle> </telerik:TreeListBoundColumn> <telerik:TreeListTemplateColumn UniqueName="PermissionsGrid" HeaderText="Permissions" DataField="Allocation"> <ItemStyle CssClass="TreeGridCell NoPadding"></ItemStyle> <ItemTemplate> <asp:Label ID="lb_GridAllocation" Font-Bold="true" Font-Italic="true" Text='<%# Eval("Allocation") %>' Visible="false" runat="server"></asp:Label> <telerik:RadGrid ID="rg_TaxonomyGroupProfiling" AllowMultiRowSelection="True" BorderStyle="None" runat="server" AutoGenerateColumns="false" OnItemDataBound="rg_TaxonomyGroupProfiling_ItemDataBound" OnItemCreated="rg_TaxonomyGroupProfiling_ItemCreated"> <ClientSettings AllowExpandCollapse="true"> <Selecting AllowRowSelect="True" UseClientSelectColumnOnly="True"></Selecting> </ClientSettings> <MasterTableView ClientDataKeyNames="Allocation" Width="100%" EditMode="InPlace"> <Columns> <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn"> </telerik:GridClientSelectColumn> <telerik:GridBoundColumn Visible="false" UniqueName="Allocation" DataField="Allocation" HeaderText="Allocation" ReadOnly="True"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="UserGroup" DataField="UserGroup" HeaderText="UserGroup" ReadOnly="True"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="Status" DataField="Status" HeaderText="Status" ReadOnly="True"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="Inherits" DataField="Inherits" HeaderText="Inherits" ColumnEditorID="GridTextBoxColumnEditor1"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="View" DataField="View" HeaderText="View" ColumnEditorID="GridTextBoxColumnEditor1"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="Competent" DataField="Process" HeaderText="Competent" ColumnEditorID="GridTextBoxColumnEditor1"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="BatchSize" DataField="BatchSize" HeaderText="Batch Size" ColumnEditorID="GridTextBoxColumnEditor1"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="Escalate" DataField="Escalate" HeaderText="Escalate" ColumnEditorID="GridTextBoxColumnEditor1"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="Suspend" DataField="Suspend" HeaderText="Suspend" ColumnEditorID="GridTextBoxColumnEditor1"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="SamplingX" DataField="SamplingX" HeaderText="SamplingX" ColumnEditorID="GridTextBoxColumnEditor1"> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="SamplingY" DataField="SamplingY" HeaderText="SamplingY" ColumnEditorID="GridTextBoxColumnEditor1"> </telerik:GridBoundColumn> <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn1"> <HeaderStyle Width="20px"></HeaderStyle> <ItemStyle CssClass="MyImageButton"></ItemStyle> </telerik:GridEditCommandColumn> </Columns> </MasterTableView> </telerik:RadGrid> <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" runat="server" TextBoxStyle-Width="35px"> </telerik:GridTextBoxColumnEditor> <telerik:GridDropDownListColumnEditor ID="GridDropDownListColumnEditor1" runat="server" DropDownStyle-Width="70px"> </telerik:GridDropDownListColumnEditor> </ItemTemplate> </telerik:TreeListTemplateColumn> </Columns></telerik:RadTreeList>protected void rtl_TaxonomyGrids_NeedDataSource(object sender, Telerik.Web.UI.TreeListNeedDataSourceEventArgs e){ if (sender is RadTreeList) { RadTreeList tree = sender as RadTreeList; tree.DataSource = null; tree.DataSource = dh.GetTaxonomyData(); }}protected void rtl_TaxonomyGrids_ItemCreated(object sender, TreeListItemCreatedEventArgs e){ if (e.Item is TreeListDataItem) { RadGrid grid = (RadGrid) e.Item.FindControl("rg_TaxonomyGroupProfiling"); grid.NeedDataSource += new GridNeedDataSourceEventHandler(rg_TaxonomyGroupProfiling_NeedDataSource); }}protected void rg_TaxonomyGroupProfiling_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e){ if (sender is RadGrid) { RadGrid grid = sender as RadGrid; grid.MasterTableView.DataSource = null; grid.DataSource = null; string taxSelection = this.GroupProfilerContainer.GroupProfilerContext.CriteriaSettings.Selection["Taxonomy"].ToString(); string gpSelection = ConverToWhereClause(this.GroupProfilerContainer.GroupProfilerContext.CriteriaSettings.Selection); TreeListDataItem nestedItem = (TreeListDataItem)(grid.NamingContainer); string allocation = nestedItem.GetDataKeyValue("Allocation").ToString(); if (!string.IsNullOrEmpty(taxSelection)) { if (taxSelection.Split(',').Contains(allocation)) { grid.DataSource = dh.GetPermissionsData(allocation, gpSelection); } } }}Thanks,
JC