Problem with SplitButton!!

Feb 5, 2013 at 9:46 AM
I have a problem with the SplitButton. If I added a "SplitButton" to ribbon, all other standard controls are disabled in list ribbon. Is there a reason for this. Can you please give me a tip.
           SPWeb web = (properties.Feature.Parent as SPWeb);
            var button1 = ControlLibrary.CreateRandomButton();
            var button2 = ControlLibrary.CreateRandomButton();
            var button3 = ControlLibrary.CreateRandomButton();
            var button4 = ControlLibrary.CreateRandomButton();
            var button5 = ControlLibrary.CreateRandomButton();
            var button6 = ControlLibrary.CreateRandomButton();
            var button7 = ControlLibrary.CreateRandomButton();
            button6.TemplateAlias = "o1";

            var splitButton = new SplitButtonDefinition()
                                  {
                                      Id = "MySplitButton",
                                      Image = ImageLibrary.GetStandardImage(3, 13),
                                      TemplateAlias = "o1",
                                      Title = "My Split Button"
                                      ,
                                      Controls = new ControlDefinition[]
                                                     {
                                                         button6, button7
                                                     },
                                      CommandEnableJavaScript = "javascript:alert(Hallo 0);",
                                      CommandJavaScript = "javascript:alert(Hallo 1);",
                                      ControlsSize = ControlSize.Size16x16
                                  };

            var group = new GroupDefinition()
                            {
                                Id = "MyGroup",
                                Title = "Custom controls",
                                Template = GroupTemplateLibrary.SimpleTemplate,
                                Controls = new ControlDefinition[]
                                               {
                                                   button2,
                                                   splitButton
                                               }
                            };

            var ribbonCustomAction = new RibbonCustomAction();
            ribbonCustomAction.AddControlGroup(group, SPRibbonIds.Library.Id, 25);

            // We need assign TemplateAlias manually to buttons, if they will be deployed separately
            button1.TemplateAlias = "o1";
            ribbonCustomAction.AddControl(button1, SPRibbonIds.Document.Groups.Manage.Id, 1);
            ribbonCustomAction.Provision(ReceiverGuid, web, ListTypes.XmlFormLibrary);
Coordinator
Feb 6, 2013 at 8:40 PM
Hi haniar,

You have syntax errors in your javascript for CommandJavaScript and CommandEnableJavaScript properties.
Also, "javascript:" is not necessary there.

So, i.e. you should have something like this:
CommandEnableJavaScript = "alert('Hallo 0');",
CommandJavaScript = "alert('Hallo 1');",