SplitButton Parent CommandName

4 posts, 0 answers
  1. Michael
    Michael avatar
    43 posts
    Member since:
    Mar 2013

    Posted 24 Apr 2013 Link to this post

    I have the following XML: 
    <SplitButton Size="Large" Text="Descriptive" ImageUrlLarge ="images/widgets_descriptive.png" CommandName="managedescriptive">
            <Button Text='ABC Codes' CommandName='descriptive' CommandArgument='1'/>
            <Button Text='Planning Data' CommandName='descriptive' CommandArgument='2'/>
          </SplitButton>

    In my code-behind I have the following function

    protected void dsxWebRibbon_SplitButton_Click(object sender, RibbonBarSplitButtonClickEventArgs args)
        {
            string commandname = args.Button.CommandName;
            string commanddata = args.Button.CommandArgument;
            switch (commandname)
            {
                case "opendc":
                    Response.Redirect("dsxDashboard.aspx");
                    break;
                default:
                    dsxCommand.InnerHtml = "Invalid Command:" + commandname;
                    break;
            }//end switch
        }

    The issue I am having is that when the parent button is clicked...it is not getting the parents commandname....what would you do to get that value

  2. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 25 Apr 2013 Link to this post

    Hello MIchael,

    The SplitButton itself doesn't have a CommandName and CommandArgument properties. These are properties of the child buttons. The Split button always has a default button, which by default is the first child button. When you click the Button part of the split button (not the dropdown arrow), the default item is clicked. So clicking the parent Split Button and clicking the first child button are the same thing. I've also attached a screenshot to demonstrate this.
     

    Greetings,
    Bozhidar
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Michael
    Michael avatar
    43 posts
    Member since:
    Mar 2013

    Posted 02 May 2013 Link to this post

    How would you get the splitbutton CommandNames and ArgumentNames with Javascript? The below does not work...

    function SplitButtonClick(sender, args) {
                var command = args.get_commandName();
                alert(command);
             
            }//end function
  5. Michael
    Michael avatar
    43 posts
    Member since:
    Mar 2013

    Posted 02 May 2013 Link to this post

    Nevermind...I am stupid...

     

    function SplitButtonClick(sender, args) {

     

    var button = args.get_button();

     

    var command = button.get_commandName();

    alert(command);

    }

     

    //end function

Back to Top