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

SplitButton Parent CommandName

3 Answers 52 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 24 Apr 2013, 03:33 PM
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

3 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 25 Apr 2013, 08:45 AM
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.
0
Michael
Top achievements
Rank 1
answered on 02 May 2013, 04:01 PM
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
0
Michael
Top achievements
Rank 1
answered on 02 May 2013, 04:08 PM
Nevermind...I am stupid...

 

function SplitButtonClick(sender, args) {

 

var button = args.get_button();

 

var command = button.get_commandName();

alert(command);

}

 

//end function

Tags
RibbonBar
Asked by
Michael
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Michael
Top achievements
Rank 1
Share this question
or