Capturing RadTreeNode info in Page_Init dynamic RadDock

8 posts, 0 answers
  1. HHalim
    HHalim avatar
    69 posts
    Member since:
    Aug 2005

    Posted 18 Jul 2007 Link to this post

    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!

  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 19 Jul 2007 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. HHalim
    HHalim avatar
    69 posts
    Member since:
    Aug 2005

    Posted 19 Jul 2007 Link to this post

    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?


  5. HHalim
    HHalim avatar
    69 posts
    Member since:
    Aug 2005

    Posted 19 Jul 2007 Link to this post

    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.


  6. Petya
    Admin
    Petya avatar
    869 posts

    Posted 20 Jul 2007 Link to this post

    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
  7. HHalim
    HHalim avatar
    69 posts
    Member since:
    Aug 2005

    Posted 20 Jul 2007 Link to this post

    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.
  8. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 24 Jul 2007 Link to this post

    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
  9. RadTony
    RadTony avatar
    39 posts
    Member since:
    Jan 2010

    Posted 11 Feb 2010 Link to this post

    Hi Hart,

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

    Thanks,
    RadTony
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017