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

DockToggleCommand client side

4 Answers 65 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Donald
Top achievements
Rank 1
Donald asked on 20 Apr 2008, 07:10 AM
I have looked through the forums but have been unsuccessful in finding a solution for my problem.

I have created a dock with a multipage control inside it, the first page has a grid which shows some data and the second page has a chart which shows the data in bar chart format.  i have been successful in adding a RadTabStrip inside the doc and controlling the pages this way.

What I want is a custom toggle button on my dock title bar to change the multipage and change the image client side. I have been successful in implementing this with a postback and just changing the state of the toggle button and changing the page, but i can not find a solution for doing this client side. 

I see that i might have to write Javascript, but i am a novice at writing script.

How can i do this?

thanks

don

4 Answers, 1 is accepted

Sort by
0
Dimcho
Telerik team
answered on 22 Apr 2008, 03:56 PM
Hello Donald,

RadDock provides the ability to create a toggle custom command. To achieve this functionality  you should use the following approach. 
Add this code in your RadDock control:

  <Commands> 
     <telerik:DockToggleCommand AutoPostBack="false" Text="Primary State" 
                 AlternateText="Alternate State" 
                 CssClass="rdPrimaryState" AlternateCssClass="rdAlternateState" 
                 State="primary" Name="MyCustomCommand"   
                 OnClientCommand="OnClientCommand" /> 
   </Commands> 

The two css classes rdPrimaryState and rdAlternateState specify the way your toggle button looks when you switch between its alternative states.

Use the OnClientCommand event to execute the needed manipulations with the content of the dock control.

 function OnClientCommand(command, args)  
 {  
     args.Command.set_state(args.Command.get_state() == 1 ? 2 : 1);  
              
     // add your logic here   
              
 } 

All the best,
Dimcho
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
ajit
Top achievements
Rank 1
answered on 12 Jun 2009, 08:46 PM
Hi,
          if you break the loop into if else...it does not work. Any ideas.
0
Pero
Telerik team
answered on 15 Jun 2009, 01:45 PM
Hi ajit,

I am not sure that I understand what is the problem. Could you please provide more information on it?


All the best,
Pero
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.
0
ajit
Top achievements
Rank 1
answered on 15 Jun 2009, 01:50 PM
Hi Pero,
                Thank you for your reply. Actually i was trying to break the condition into an if-else loop but i figured it out.
Thank you very much.

Regards,
Ajit
           
Tags
Dock
Asked by
Donald
Top achievements
Rank 1
Answers by
Dimcho
Telerik team
ajit
Top achievements
Rank 1
Pero
Telerik team
Share this question
or