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

How can I call a javascript function when a dock is expanded or collapsed?

2 Answers 76 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Brent Hetland
Top achievements
Rank 1
Brent Hetland asked on 23 Sep 2013, 07:41 PM
Hi,

I am using version Q2 717 2013 of the ASP.NET for AJAX controls.

I'm using the RadDock.

I don't see a client event that I can assign a function to, for when the user clicks the expand / collapse button.  Is there one?

FYI:  I've implemented a custom close button, so I've also added the following line of code in code-behind, to add the expand / collapse button.

		dock.Commands.Add(New DockExpandCollapseCommand())

Again, my goal / question is:  I want to run some client-side code (NOT do a postback) after the user has expanded or collapsed a dock.  How can I do that?

Thanks,
Brent

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 24 Sep 2013, 05:14 AM
Hi Brent Hetland,

Please have a look at the following code snippet I have tried to invoke the client side event for Expand/Collapse button of RadDock.

ASPX:
<telerik:RadDock ID="RadDock1" runat="server" Title="Item1">
    <Commands>
        <telerik:DockExpandCollapseCommand OnClientCommand="OnClientCommand" />
    </Commands>
    <ContentTemplate>
        <telerik:RadTextBox ID="RadTextBox1" runat="server">
        </telerik:RadTextBox>
        <br />
        <br />
        <telerik:RadButton ID="RadButton1" runat="server" Text="demo">
        </telerik:RadButton>
    </ContentTemplate>
</telerik:RadDock>

JavaScript:
<script type="text/javascript">
    function OnClientCommand(sender, args) {
        if (args.command._clientTypeName == "Telerik.Web.UI.DockExpandCollapseCommand") {
            alert("Fired");
        }
    }
</script>

Thanks,
Shinu
0
Brent Hetland
Top achievements
Rank 1
answered on 24 Sep 2013, 11:01 AM
I'm adding my raddocks dynamically in code behind, so I did it like this and it works.  Thanks Much!

		Dim ExpandCollapseCommand As DockExpandCollapseCommand = New DockExpandCollapseCommand()
		ExpandCollapseCommand.OnClientCommand = "OnClientCommand"
		dock.Commands.Add(ExpandCollapseCommand)

Tags
Dock
Asked by
Brent Hetland
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Brent Hetland
Top achievements
Rank 1
Share this question
or