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

Dynamiccaly created Dock handling

7 Answers 231 Views
Dock
This is a migrated thread and some comments may be shown as answers.
saygin
Top achievements
Rank 1
saygin asked on 14 Aug 2007, 08:33 PM
Hi,
Regarding Valeri's Portal Site Demo, I want to know at which stage can I handle Dock objects.
For example, if a dock is dragged to a particular zone ; I want to set its ForbiddenZones to something. But as far as i can see, dock cannot be set after the postback occurs. Please correct me if i am wrong.
As another example, I want to "Close" all docks in a zone (or delete) on a buttonClick event. A simple example would be very helpful.
Thanks a lot for your help.

7 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 15 Aug 2007, 01:20 PM
Hello saygin,

Please, find the attached project. It is a modification of My Portal example and shows how to set the ForbiddenZones and how to delete all docks in a zone. Hope you find it helpful.

Kind regards,
Petya
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
saygin
Top achievements
Rank 1
answered on 15 Aug 2007, 03:06 PM
Hello Petya,
Actually, the example doesn't show how to set the forbidden zones or, deleting the docks on a zone. But it shows to Collapse the docks with javascript. Well, I know I can follow the same way for my purposes.
However, what I want to do is to set these properties in codebehind, not in client. In ButtonAddDock_Click , delete docks in a zone ; then add docks to that zone.
Petya, my colleague Talha asked about the same problem to Valeri, that we both are having trouble about. But to keep that thread clean, I am writing here.
Again, what I am trying to do is deleting the docks in a particular zone, and add some other docks to the same zone. I am doing it based on Valeri's example about adding multi docks at a time.
(http://www.telerik.com/ClientsFiles/059948_MyPortal.zip)

A simple example would really help.
Thanks a lot for your interest.
0
Petya
Telerik team
answered on 16 Aug 2007, 12:39 PM
Hello saygin,

I understand what you try to achieve and we will try to prepare an example for you. However, let me clarify something first - I already asked Talha about this but I need a bit more information. How many zones do you have on your page - only left and right or more? When you add a dock (clicking the Add Dock button) do you always add it to the left zone or you can choose from a dropdown list with zones and add it to another zone? Anything else about the specifics of your requirements may be also helpful as information for us because depending on the information you provide we may take different approaches for building the example.

Regards,
Petya
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
saygin
Top achievements
Rank 1
answered on 16 Aug 2007, 06:11 PM
Hello Petya,
Yes, there are two zones.Left and right ones.
When I add a dock (clicking the Add Dock button) , it depends on where to add. It is selected from a drop down menu. Once that button is clicked, I wanted the docks in the selected zone, be deleted ; and be added new ones.
I couldn't find a way to achieve it on server side. However, I did it on the client side, using OnRequestStart function.
Posting it here; may help somebody.
            function OnRequestStart(sender, arguments) 
            { 
                var zone = $find('<%= ZnLeft.ClientID%>'); 
                 
                var numberDocksInZone = zone.get_Docks().length; 
                var docksArray = zone.get_Docks(); 
                for(var i = 0; i < numberDocksInZone; i++) 
                { 
                    docksArray[i].set_Closed(true); 
                } 
            } 
 

I also needed help to forbidden docks in right dock, be dropped to left dock.
I did it again on the client side using th code below.
            function OnResponseEnd(sender, arguments) 
            {                              
                var zone = $find('<%= ZnRight.ClientID%>'); 
                var zoneForbidden = $find('<%= ZnLeft.ClientID%>'); 
                var numberDocksInZone = zone.get_Docks().length; 
                var docksArray = zone.get_Docks(); 
                var myArray = '<%= ZnLeft.ClientID%>'.split(' '); 
                for(var i = 0; i < numberDocksInZone; i++) 
                { 
                    docksArray[i].set_ForbiddenZones(myArray); 
                } 
            } 
 

Thank you
Saygın
0
Petya
Telerik team
answered on 17 Aug 2007, 09:18 AM
Hello saygin,

As far as I understand, you have managed to solve your problem. In case I am wrong, please contact us again and tell us if we should still prepare the example for you.

Regards,
Petya
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Joel
Top achievements
Rank 1
answered on 10 Mar 2009, 07:57 PM
This post deals with the AJAX 2008 RADDOCK

It sounds like saygin was searching for a server-side way to delete docks from within a raddockzone.  I have two docks similar to saygin and I handle the delete in the database with my own code.  The issue is that once the delete occurs in the database the page is not refreshed.  The dock remains on the screen in the dock where I attempted to delete it from.  If I leave the page and navigate back the dock is gone.  If I try to reload the page from the database I get an error that the rad dock ID i am adding already exists on the page.  If I can essentially "flush" the rad dock zones of all docks I can then call my function to load the docks back sucessfully. 

I tried to use this code but it didnt seem to work at all:

     //delete all docks from the zones 
            foreach (RadDockZone zone in DockLayout.RegisteredZones) 
            { 
                zone.Controls.Clear(); 
            } 

Thanks for your assistance!
0
Petio Petkov
Telerik team
answered on 16 Mar 2009, 02:02 PM
Hi Joel,

As far I understand your goal, you want to remove some RadDocks on each postback. My suggestion is to create all RadDocks dynamically. In case you want to "remove" RadDocks on postback you shouldn't recreate them and they will not appear on the client.

A simple example which illustrates how to save/load state to the DB of dynamically created RadDocks via AJAX is available here:
http://www.telerik.com/community/forums/aspnet-ajax/docking/saving-floating-dock-position-when-no-dockzone-in-layout.aspx

If your goals are different  please describe them in more details.

Greetings,
Petio Petkov
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Dock
Asked by
saygin
Top achievements
Rank 1
Answers by
Petya
Telerik team
saygin
Top achievements
Rank 1
Joel
Top achievements
Rank 1
Petio Petkov
Telerik team
Share this question
or