Telerik
Home / Community / Forums / RadControls for ASP.NET: Docking / Hooking the Expand/Collapse event.

Hooking the Expand/Collapse event.

Feed from this thread
  • Chris Holmok avatar

    Posted on Aug 21, 2006 (permalink)

    Is there a way (either server-side, or preferably client-side) to hook the the expand/collapse event of dock object?  I want to save it's expanded/collapsed state in the user's profile in ASP.NET 2.0. 

    Thanks.

    Reply

  • Telerik Admin admin's avatar

    Posted on Aug 21, 2006 (permalink)


    Hello Chris,

    You must add the Collapse and Expand commands. After that, you must set their  AutoPostBack property to true.

    <radDk:RadDockableObject ID="RadDockableObject1" runat="server" Text="1" OnCommand="RadDockableObject1_Command">  
                <Commands> 
                    <radDk:RadDockableObjectCommand AutoPostBack="True" Enabled="False" Name="Expand"  ToolTip="Expand" /> 
                    <radDk:RadDockableObjectCommand AutoPostBack="True" Name="Collapse"  ToolTip="Collapse" /> 
                </Commands> 
            </radDk:RadDockableObject> 

    Also you must add a handler in code behind to the RadDockableObject  (OnCommand="RadDockableObject1_Command)

    and do something in code behind:

       protected void RadDockableObject1_Command(object sender, EventArgs e)  
        {  
           //doSomething  
        } 



    Best regards,
    Petio Petkov
    the telerik team

    Reply

  • Barry Intermediate avatar

    Posted on Sep 10, 2006 (permalink)

    Hello,

    As you might have noticed, I've been working with the Docking stuff this weekend.  Cool stuff, by the way!

    Is there a way to do a Client-Side event here?

    When a user makes a change to the layout of their page, I'm making a link to save their changes visible (which was, of course, previously hidden).  I'd like to make this link available for when someone expands or collapses a window, too.  I don't want to do a postback.

    I can probably just make this link always visible, and I might go that route, but I'd like to see if this is possible, first.

    Thanks.
    --Barry

    Reply

  • Telerik Admin admin's avatar

    Posted on Sep 11, 2006 (permalink)


    Hi Barry,

    You must add onclientcommand="showlink" to expand and Collapse commands:
      <radDk:RadDockableObjectCommand  Name="Collapse"  ToolTip="Collapse" onclientcommand="showLink"/> where showlink function will show the link using javascript.
    A simple example using custom commands and handling client side events, you can find at:
    http://www.telerik.com/r.a.d.controls/Dock/Examples/Commands/DefaultCS.aspx

    All the best,
    Petio Petkov
    the telerik team

    Reply

  • Vic avatar

    Posted on May 6, 2008 (permalink)

    If you are having issues with the EventArgs e, cast it to its correct type:
    protected void RadDockingZone1_OnCommand(object sender,  EventArgs e)  
    {  
        RadDockableObjectCommandEventArgs e2 = e as RadDockableObjectCommandEventArgs;  
     
        switch (e2.Command.Name)  
        {  
            case "Expand":  
            //Do something  
                break;  
        }  
    }  

    Reply

Powered by Sitefinity ASP.NET CMS

Contact Us | Site Feedback | Terms of Use | Privacy Policy
Copyright © 2002-2009 Telerik. All rights reserved.