
<telerik:GridBoundColumn UniqueName="DOB" DataField="DOB" HeaderText="DOB" CurrentFilterFunction="EqualTo" ShowFilterIcon="False" AutoPostBackOnFilter="True" DataFormatString="{0:d}" DataType="System.DateTime"> <ItemStyle HorizontalAlign="Right" /> <HeaderStyle HorizontalAlign="Right" Width="100px" /> <FooterStyle HorizontalAlign="Right" /> </telerik:GridBoundColumn>protected void RadTreeView2_TemplateNeeded(object sender, RadTreeNodeEventArgs e){ bool someCondition = true; if (someCondition) e.Node.NodeTemplate = new BoxTemplate(); else e.Node.NodeTemplate = new OtherTemplate();}class BoxTemplate : ITemplate{ public void InstantiateIn(Control container) { Label nodeLabel = new Label(); nodeLabel.ID = "NodeLabel"; nodeLabel.DataBinding += new EventHandler(NodeLabel_DataBinding); container.Controls.Add(nodeLabel); ImageButton delButton = new ImageButton(); delButton.ImageUrl = "~/images/icons/delete16.png"; delButton.OnClientClick = "return ConfirmDelete();"; container.Controls.Add(delButton); } private void NodeLabel_DataBinding(object sender, EventArgs e) { Label theLabel= (Label)sender; RadTreeNode node = (RadTreeNode)theLabel.BindingContainer; theLabel.Text = (string)DataBinder.Eval(node, "Text"); }}Dear all
I wonder if somebody could help clarify something about the persistence behaviour I should be expecting from the RadTreeView's EnableViewState property? I am not sure if I am seeing the behaviour by design or not ...
I have a RadTreeView control which does not appear to maintain its node display arrangement after a postback, in that if the user expands a node, after postback the node has been collapsed once more. Also, when it comes to the underlying datasource bindings etc of the RadTreeView control, it seems as though the control does not persist the Datasource property, for example, that is configured when the control first loads on the initial post of the page. For example, the RadTreeView in question binds to a hierarchical datasource object, but I am having to reconfigure the RadTreeView to a datasource object after each postback, which seems a little counter-intuitive, and a bit of an inefficiency that I would expect the RadTreeView control to avoid by maintaining the state of the datasource object. Perhaps the data configuration and hierarchy display changes would need to be made manually with a Session object instead?
However, I would be interested to know if this is the correct way to go about this issue, or whether I am missing something of importance.
Thanks very much for any advise!
Regards

<telerik:GridDateTimeColumn DataField="ValidFromDate" FilterControlAltText="Filter ValidFromDate column" HeaderText="Valid From" UniqueName="ValidFromDate" DataFormatString="{0:MM/dd/yyyy}" MinDate="1901-01-01" MaxDate="9999-12-31 23:59:59.999999"></telerik:GridDateTimeColumn><telerik:GridDateTimeColumn DataField="ValidToDate" FilterControlAltText="Filter ValidToDate column" HeaderText="Valid To" UniqueName="ValidToDate" DataFormatString="{0:MM/dd/yyyy}" MinDate="1901-01-01" MaxDate="9999-12-31 23:59:59.999999"></telerik:GridDateTimeColumn><telerik:GridTemplateColumn HeaderText="Override Discount $" UniqueName="OverrideDiscount"> <ItemTemplate> <telerik:RadNumericTextBox NumberFormat-DecimalDigits="2" ID="txtOverrideDiscountDsp" runat="server" gmNumberFormat-AllowRounding="False" Type="Currency" Width="52px" BackColor="Transparent" BorderStyle="None" Value='<%#CoalesceNumericValuesToRadNumberControl(DataBinder.Eval(Container.DataItem, "UpdateCustomerPrice"), null) %>'> </telerik:RadNumericTextBox> </ItemTemplate> <EditItemTemplate> <telerik:RadNumericTextBox NumberFormat-DecimalDigits="2" ID="txtOverrideDiscount" runat="server" AutoPostBack="true" OnTextChanged="txtOverrideDiscount_OnTextChanged" gmNumberFormat-AllowRounding="False" Type="Currency" Value='<%#CoalesceNumericValuesToRadNumberControl(DataBinder.Eval(Container.DataItem, "CustomerPrice"), null) %>'> </telerik:RadNumericTextBox> </EditItemTemplate></telerik:GridTemplateColumn>