DockToggleCommand get state server side

3 posts, 0 answers
  1. Michael
    Michael avatar
    51 posts
    Member since:
    Dec 2008

    Posted 25 Jul 2011 Link to this post

    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. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 27 Jul 2011 Link to this post

    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Michael
    Michael avatar
    51 posts
    Member since:
    Dec 2008

    Posted 27 Jul 2011 Link to this post

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