DockToggleCommand client side

5 posts, 0 answers
  1. Donald
    Donald avatar
    5 posts
    Member since:
    Apr 2008

    Posted 20 Apr 2008 Link to this post

    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
  2. Dimcho
    Admin
    Dimcho avatar
    45 posts

    Posted 22 Apr 2008 Link to this post

    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
  3. ajit
    ajit avatar
    46 posts
    Member since:
    Jun 2009

    Posted 12 Jun 2009 Link to this post

    Hi,
              if you break the loop into if else...it does not work. Any ideas.
  4. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 15 Jun 2009 Link to this post

    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.
  5. ajit
    ajit avatar
    46 posts
    Member since:
    Jun 2009

    Posted 15 Jun 2009 Link to this post

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