Dynamically Created Docks. How to set properties ?

7 posts, 0 answers
  1. MrAlex
    MrAlex avatar
    11 posts
    Member since:
    May 2007

    Posted 18 May 2007 Link to this post

    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?
  2. Petya
    Admin
    Petya avatar
    869 posts

    Posted 21 May 2007 Link to this post

    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
  3. MrAlex
    MrAlex avatar
    11 posts
    Member since:
    May 2007

    Posted 22 May 2007 Link to this post

    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.
  4. MrAlex
    MrAlex avatar
    11 posts
    Member since:
    May 2007

    Posted 22 May 2007 Link to this post

    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.
  5. Petya
    Admin
    Petya avatar
    869 posts

    Posted 23 May 2007 Link to this post

    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
  6. MrAlex
    MrAlex avatar
    11 posts
    Member since:
    May 2007

    Posted 23 May 2007 Link to this post

    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.
  7. Petya
    Admin
    Petya avatar
    869 posts

    Posted 23 May 2007 Link to this post

    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
Back to Top