Hello,
First step: I have a generic page with a tree list control which is by default not visible.
On some conditions, I make it visible and bind it on a datatable, result of a stored procedure.
The columns are all autogenerated, so the stored procedure returns at least a column named DataKey and one named ParentDataKey (as named in the tree list declaration).
This works correctly.
Second step: I don't want to display the identifers used as data key and as parent data key. So I add some code just after the binding to hide those column.
This works correctly.
Third step (the problem arrives):
The datatable, result of the stored procedure is saved in viewstate.
In the page_load method, on postback, the datatable is get from viewstate and the tree list is bind on it.
At this moment, I run the some code to hide the data key and parent data key columns, but it doesn't work.
I checked on debug, in page_load the display property is well set to false for the two columns (I also tried the visible property)
but the two columns are always visible.
Someone has an idea to hide those columns ?
Thanks by advance.
Regards,
Damien
First step: I have a generic page with a tree list control which is by default not visible.
On some conditions, I make it visible and bind it on a datatable, result of a stored procedure.
The columns are all autogenerated, so the stored procedure returns at least a column named DataKey and one named ParentDataKey (as named in the tree list declaration).
<
telerik:RadTreeList
runat
=
"server"
ID
=
"RadTreeList1"
Skin
=
"Telerik"
AutoGenerateColumns
=
"true"
DataKeyNames
=
"DataKey"
ParentDataKeyNames
=
"ParentDataKey"
AllowSorting
=
"true"
ItemStyle-CssClass
=
"RowStyle"
AlternatingItemStyle-CssClass
=
"AlternatingRowStyle"
HeaderStyle-CssClass
=
"HeaderStyle"
SelectedItemStyle-CssClass
=
"SelectedRowStyle"
OnAutoGeneratedColumnCreated
=
"RadTreeList1_OnColumnCreated"
Visible
=
"false"
>
<
ClientSettings
>
<
Scrolling
AllowScroll
=
"true"
UseStaticHeaders
=
"true"
/>
<
Resizing
AllowColumnResize
=
"true"
ResizeMode
=
"NoScroll"
/>
</
ClientSettings
>
</
telerik:RadTreeList
>
Second step: I don't want to display the identifers used as data key and as parent data key. So I add some code just after the binding to hide those column.
// Bind data with tree list display control
this.RadTreeList1.DataSource = myDataTable;
this.RadTreeList1.DataBind();
// Hide the DataKey and ParentDataKey columns
foreach (var c in this.RadTreeList1.AutoGeneratedColumns)
{
if (c.UniqueName.Equals("DataKey") || c.UniqueName.Equals("ParentDataKey"))
{
c.Display = false;
}
}
This works correctly.
Third step (the problem arrives):
The datatable, result of the stored procedure is saved in viewstate.
In the page_load method, on postback, the datatable is get from viewstate and the tree list is bind on it.
At this moment, I run the some code to hide the data key and parent data key columns, but it doesn't work.
I checked on debug, in page_load the display property is well set to false for the two columns (I also tried the visible property)
but the two columns are always visible.
Someone has an idea to hide those columns ?
Thanks by advance.
Regards,
Damien