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

DockToggleCommand get state server side

2 Answers 38 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 25 Jul 2011, 07:47 PM

I need to use the DockToggleCommand in order for the user to switch how the user will view the data within the dock. (ie. Grid Format vs. Chart Format).  The command button would autopostback and switch views depending ont he State of the toggle button. How do I need to check for the state of the ToggleCommand server side so I can return the correct data format and change the command graphic to an appropriate icon?

The following code gets fired but always returns "Primary".

protected void RadDock_Command(object sender, DockCommandEventArgs e)
{
    
    if (e.Command.Name == "MyCustomCommand")
    {
        RadDock rd = (RadDock)sender; 
         DockToggleCommand toggleCommand = e.Command as DockToggleCommand;
        string strState = toggleCommand.State.ToString();
        TextBox1.Text = strState;
    }
      
      
}




2 Answers, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 27 Jul 2011, 12:31 PM
Hi Michael,

  RadDock does not currenly persist the state of the ToggleCommand through postbacks out of the box, yet there is a possible approach that can fulfill your requirement. You may use a hidden field to store the current state of the ToggleCommand and then to set the toggle state and the content of the RadDock according to its value.

I have attached a sample project, implementing the suggested approach. You can use it as a basis for your further development.

In the following link you can check the PITS Issue that I logged for this feature request: Public URL. If enough votes are accumulated we will try to implement it for one of the upcoming releases.


Greetings,
Slav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Michael
Top achievements
Rank 1
answered on 27 Jul 2011, 01:02 PM
Thanks for the work around.  That works for me.   I just figured that since the toggle State was being tracked it would persist during postback and didn't see it stated otherwise.
Tags
Dock
Asked by
Michael
Top achievements
Rank 1
Answers by
Slav
Telerik team
Michael
Top achievements
Rank 1
Share this question
or