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

Capturing RadTreeNode info in Page_Init dynamic RadDock

7 Answers 90 Views
Dock
This is a migrated thread and some comments may be shown as answers.
HHalim
Top achievements
Rank 2
HHalim asked on 19 Jul 2007, 02:31 AM
Hello,
I created a page based on raddock MyPortal example. I added a RadTreeView to the left side of the raddocklayout. In the treeview I have several parent node, each parent node contains 0-many child nodes, each child node represent a dock object.

Now, everytime I click a parent node, I want to clear the docklayout and generate all the children nodes as dock objects. However the Page_Init does not have the information for which parent node I've clicked.
BTW I added the async trigger for treeview in the UpdatePanel1:
<asp:asyncpostbacktrigger controlid="TreeView" eventname="NodeClick" />

How do I get the parent node object in Page_Init, all I need is one of the node attribute (pageID) and from there I can load all the children information from a database table to create the raddock objects.

Or maybe there is a better approach to what I'm trying to do?

Thanks!

7 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 19 Jul 2007, 12:40 PM
Hello hhalim,

The requirement to create the controls in Page_Init is to ensure that the RadDock controls will raise their DockPositionChanged events properly. If it is the first time you are creating a specific RadDock control, there is nothing wrong to do it in Button_Click, Page_Load or TreeView_NodeClick, if on the next postback you recreate it in Page_Init. Regarding your specific scenario: you could clear and recreate the RadDock controls in the NodeClick event of RadTreeView, but you should make sure that the controls will be recreated in Page_Init if the user performs a postback.

All the best,
Valeri Hristov (Senior Developer, MCSD)
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
HHalim
Top achievements
Rank 2
answered on 19 Jul 2007, 04:56 PM
Thank you for the reply.

Well, I've tried to add the dock objects after Tree_NodeClick event.

I tried two different ways, first using radajax that refreshes the dock zone, this creates the dock objects, but I can't drag&drop it, when I tried to drag it many times, it gives me:
Microsoft JScript runtime error: 'Telerik.Web.UI.RadDock.DragDataType' is null or not an object
The close and collapse dock commands are not working either.

Then I tried the MyPortal sample AddDock() way, using adding each dock object to the UpdatePanel1 and move it to the dockzone after node click event. This does not work at all, it produces and error on ScriptResource.axd:
a.control=this;
Microsoft JScript runtime error: 'undefined' is null or not an object
Using this UpdatePanel1 move method also does not allow clearing the dockzone from previous dock objects.

Does anyone ever integrate RadTreeView and dynamic raddock, or this is just not possible?


0
HHalim
Top achievements
Rank 2
answered on 19 Jul 2007, 10:32 PM
Okay, I changed my tree node click to full postback for double click event. This seems to work fine now for my case, but then I run into the Dock.Index not being persisted bug, found a thread here: dock.Index bug

Also, is there a way to clear the DockLayout from existing raddock objects without iterating through the RadDockLayout.Controls?

It would be nice to have an API such as DockLayout.ClearRegisteredDocks().  I found out that clearing the DockZone.Docks.Clear() does not clear the docks from the DockLayout.


0
Petya
Telerik team
answered on 20 Jul 2007, 12:24 PM
Hello hhalim,

The issue with the index is as described in the thread you have found - it has not been solved yet. As far as your question with Clear is concerned - I am not sure I fully understand what you try to achieve. Please, describe the desired result and we will provide some guidance how to achieve it.

Kind regards,
Petya
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
HHalim
Top achievements
Rank 2
answered on 20 Jul 2007, 02:07 PM
Any ETA when the index bug will be resolved? My project needs it badly and the workaround described in the thread doesn't work.

After further investigation, I think there is a possible bug with RadDockLayout. As I wrote in the start of this thread, I tried to integrate treeview with RadDock, so when a used double click a treenode, the webpage generates raddock objects from the node's children. If a user clicks a different treenode, the page DockLayout must be completely cleared out and replaced with the new children docks.
When I re-generate the raddock objects, I do this first:
DockZone.Docks.Clear(); // Clear out the RadDockZone 
ControlCollection controls = DockLayout.Controls; //Clear the DockLayout controls 
foreach (Control cont in controls) 
     if (cont is RadDock) 
     DockLayout.Controls.Remove(cont); 
 

When the code loops through all the controls in RadDockLayout, a RadDock control is still found. All the RadDock objects are docked in one zone, no free floating dock control. The DockZone.Docks.Clear() clears all the docks, but I found that there is one dock left in the DockLayout.

Thanks.
0
Valeri Hristov
Telerik team
answered on 24 Jul 2007, 02:47 PM
Hello,

We will try to provide a bugfix by the end of the week. I am sorry for the inconvenience. Check this forum again after a couple of days for a sticky thread with the latest build.

Sincerely yours,
Valeri Hristov (Senior Developer, MCSD)
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
RadTony
Top achievements
Rank 1
answered on 11 Feb 2010, 11:11 AM
Hi Hart,

        Could you please send me your code ? I want to do exactly that and if it's already done ...

Thanks,
RadTony
Tags
Dock
Asked by
HHalim
Top achievements
Rank 2
Answers by
Valeri Hristov
Telerik team
HHalim
Top achievements
Rank 2
Petya
Telerik team
RadTony
Top achievements
Rank 1
Share this question
or