This is a migrated thread and some comments may be shown as answers.

treeview not visible on first load

4 Answers 174 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Vandara Peou
Top achievements
Rank 1
Vandara Peou asked on 24 Mar 2009, 09:03 PM
Hi,

I'm having a wierd issue with databinding my treeview control on page_init event. Basically on the first load of the control it's not visible--non of its nodes are rendedered. Any subsequent requests to the same page though and the control appears and functions normally. This isn't a problem when loading the control on page_load although i need to do it in page_init for page life cycle and viewstate reasons.

Any insight into this?

Thanks,
Vandara Peou

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 25 Mar 2009, 01:57 PM
Hi Vandara Peou,

Unfortunately the provided information does not indicate the reason for the problem. RadTreeView should work as expected when populated during Page_Init. Could you verify that the treeview is not empty the first time - Nodes.Count should be greater than zero.

Regards,
Albert
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Vandara Peou
Top achievements
Rank 1
answered on 25 Mar 2009, 02:12 PM
Hi,

The node code is greater than zero when I step through the code in Page_Init, but once i hit Page_Load or Page_PreRender and I check the node code it becomes zero. This only happens on the very first page load. On every subsequent load everything works as intended. There is no other code affecting the treeview.

The tree view is declared as follows:

<

telerik:RadTreeView ID="rtvLocations" Runat="server" Height="350px" Width="286px" CheckBoxes="True" Skin="Default"></telerik:RadTreeView>

And the code to load it is as follows:

 

 

With rtvLocations

 

.DataSource = dtDestinations

.DataValueField =

"LocationID"

 

 

 

.DataTextField =

"LocationDisplay_Name"

 

 

 

.DataFieldID =

"LocationID"

 

 

 

.DataFieldParentID =

"ParentID"

 

 

 

.DataBind()

 

End With

 

0
Atanas Korchev
Telerik team
answered on 25 Mar 2009, 02:16 PM
Hello Vandara Peou,

This means that something is clearing the nodes between the Init and Render stage. We cannot tell why this happens unless we see a running project which demonstrates your problem. I suggest you open a support ticket and send us your page as attachment.

Regards,
Albert
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Vandara Peou
Top achievements
Rank 1
answered on 25 Mar 2009, 03:00 PM
I was able to fix the problem. I simply did a load on both Page_Init and Page_Load with the one on page load checking to see if it has any nodes first.
Tags
TreeView
Asked by
Vandara Peou
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Vandara Peou
Top achievements
Rank 1
Share this question
or