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

Dynamically Created Docks. How to set properties ?

6 Answers 210 Views
Dock
This is a migrated thread and some comments may be shown as answers.
MrAlex
Top achievements
Rank 1
MrAlex asked on 18 May 2007, 09:09 PM
I would like to dynamically create and appear docks in 2 Zones.
contens of each dock should be populated from database(text+ image), should be docable(not floating) and has no Commands(if possible).
1.How to set such properties as DockMode or DefaultCommands?
2.Is it possible to set up maximum number of RadDocks for each Zone?

6 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 21 May 2007, 09:51 AM
Hello,

If you want your RadDock object to be docked and not floating you need to set:

dock.DockMode = DockMode.Docked;

More information about DockMode you can find here. To set DefaultCommands use the following syntax:

dock.DefaultCommands = Telerik.Web.UI.Dock.DefaultCommands.ExpandCollapse | Telerik.Web.UI.Dock.DefaultCommands.Close;

There is no property that limits the number of RadDock objects within a zone. You will need to control this through the logic of your code upon creation of RadDocks and adding them to a zone. I am attaching a simple page demonstrating a possible approach towards the question.

Sincerely yours,
Petya
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
MrAlex
Top achievements
Rank 1
answered on 22 May 2007, 05:12 PM
Thank you for help. It works fine. I have more questions:)
How to add event handler to a dock when I create it from the code?
I want to create client script to move docks between zones based on different conditions and use it with dinamically created docks. For example: We have 2 zones:top and bottom. I want always keep maximum 3 docks in zone: 'top'. Thus If client move dock from zone 'bottom' to zone 'top' (this zone already has 3 docks), on of docks in zone "top" should be "replaced", e.g. moved to zone "bottom" instead.
0
MrAlex
Top achievements
Rank 1
answered on 22 May 2007, 05:29 PM
More in details.
I have hardcoded dock.
==================
 <telerik:raddock id="RadDock1" runat="server" onclientdragend="OnClientDragEnd" onclientdragstart="OnClientDragStart" text="RadDock1"
                                title="RadDock1">
 </telerik:raddock>
==================
I want dinamically create this dock.
0
Petya
Telerik team
answered on 23 May 2007, 07:00 AM
Hello,

Here is what you can do:

[C#]

...create a new RadDock dynamically....

dock.OnClientDragEnd = "OnClientDragEnd";
dock.OnClientDragStart = "OnClientDragStart";

.....

[ASPX]

<script type="text/javascript">
    function OnClientDragEnd(sender, args)
    {
         //your logic here
    }
    function OnClientDragStart(sender, args)
    {
        //your logic here
    }
    </script>


Hope this helps. Let me know if you have any more troubles or questions.

Best wishes,
Petya
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
MrAlex
Top achievements
Rank 1
answered on 23 May 2007, 01:05 PM
Thank's Petya!  Actually, I found answer already  by myself. Anyway, I apreciate your  responce.  I got latest version of Prometheus and started new proptotype yesterday. I think what you are really missing on your site: full documentation with small examples to each properties and method (like on MSDN). I know , you are working hard, but, please, consider to update Prometeus controls docks.
And one more question:)
I have several docks in two DockZones populated from the code. All docks are dockable. User can move docks between Zones. After all  need to know which docks located in each Zone or to find specific dock(for example, by ID). Please, give some examples, for both side: client and server.
0
Petya
Telerik team
answered on 23 May 2007, 01:59 PM
Hello,

1. You can get the ID of the RadDockZone that a RadDock object is docked to in the following way:

[C#]

RadDock1.DockZoneID

[JavaScript]

var dock = $find('<%= RadDock1.ClientID%>');
dock.get_parent().get_id();

2. Concerning RadDockZone properties to locate a RadDock:

[C#]

use the properties of RadDockZone1.Docks collection

[JavaScript]

var zone = $find('<%= RadDockZone1.ClientID%>');
var myarray = zone.get_Docks();
dockArray[0].get_id();

All the best,
Petya
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Dock
Asked by
MrAlex
Top achievements
Rank 1
Answers by
Petya
Telerik team
MrAlex
Top achievements
Rank 1
Share this question
or