SharePoint: Custom Ribbon + IE = Error in cui.debug.js (Invalid argument.) - sharepoint

I am having really hard time debugging this one. I have a standard WebPart in SharePoint 2010 with custom Ribbon on it. Everything works great in FireFox, Safari and Chrome. But when it comes to IE, I get the following error.
Webpage error details
User Agent: Mozilla/4.0 (compatible;
MSIE 8.0; Windows NT 6.1; WOW64;
Trident/4.0; SLCC2; .NET CLR
2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; InfoPath.3; .NET4.0C;
.NET4.0E) Timestamp: Thu, 23 Jun 2011
05:29:39 UTC
Message: Invalid argument. Line: 11611
Char: 17 Code: 0 URI:
http://example.com/_layouts/cui.debug.js?rev=seEKIhJXfBClfYcr46fd3w%3D%3D
I am attaching the code snippets I feel that might be helpful to you.
Definition for Contextual Tab:
<ContextualGroup Id="Ribbon.MyWPContextualTabGroup"
Color="Blue"
Title="{title}"
Command="MyWPContextualTab.EnableContextualGroup"
Sequence="502"
ContextualGroupId="MyWPContextualTabGroup">
<Tab Id="Ribbon.MyWPTab"
Title="My Work"
Description="My Work tab description"
Command="MyWPContextualTab.EnableMyWPTab"
Sequence="501">
<Scaling Id="Ribbon.MyWPTab.Scaling">
<MaxSize Id="Ribbon.MyWPTab.MaxSizeNew"
GroupId="Ribbon.MyWPTab.MyWPGroupNew"
Size="MyWPLayout" />
<MaxSize Id="Ribbon.MyWPTab.MaxSizeManage"
GroupId="Ribbon.MyWPTab.MyWPGroupManage"
Size="MyWPLayout" />
<MaxSize Id="Ribbon.MyWPTab.MaxSizeViews"
GroupId="Ribbon.MyWPTab.MyWPGroupViews"
Size="MyWPLayout" />
<MaxSize Id="Ribbon.MyWPTab.MaxSizeShareTrack"
GroupId="Ribbon.MyWPTab.MyWPGroupShareTrack"
Size="MyWPLayout" />
<MaxSize Id="Ribbon.MyWPTab.MaxSizeWorkflows"
GroupId="Ribbon.MyWPTab.MyWPGroupWorkflows"
Size="MyWPLayout" />
<Scale Id="Ribbon.MyWPTab.Scaling.MyWPTabScalingNew"
GroupId="Ribbon.MyWPTab.MyWPGroupNew"
Size="MyWPLayout" />
<Scale Id="Ribbon.MyWPTab.Scaling.MyWPTabScalingManage"
GroupId="Ribbon.MyWPTab.MyWPGroupManage"
Size="MyWPLayout" />
<Scale Id="Ribbon.MyWPTab.Scaling.MyWPTabScalingViews"
GroupId="Ribbon.MyWPTab.MyWPGroupViews"
Size="MyWPLayout" />
<Scale Id="Ribbon.MyWPTab.Scaling.MyWPTabScalingShareTrack"
GroupId="Ribbon.MyWPTab.MyWPGroupShareTrack"
Size="MyWPLayout" />
<Scale Id="Ribbon.MyWPTab.Scaling.MyWPTabScalingWorkflows"
GroupId="Ribbon.MyWPTab.MyWPGroupWorkflows"
Size="MyWPLayout" />
</Scaling>
<Groups Id="Ribbon.MyWPTab.Groups">
<Group Id="Ribbon.MyWPTab.MyWPGroupNew"
Description="New group description"
Title="New"
Command="MyWPContextualTab.EnableMyWPGroupNew"
Sequence="52"
Template="Ribbon.Templates.MyWPTemplate">
<Controls Id="Ribbon.MyWP.New.Controls">
<Button Id="Ribbon.MyWP.New.NewItem"
Command="MyWP.Cmd.NewItem"
Description="Add a new item"
LabelText="New Item"
TemplateAlias="ONERW"
Image32by32="_layouts/images/MyWP/ribbon/newitem-32.png"
Image16by16="_layouts/images/MyWP/ribbon/newitem-16.png" />
</Controls>
</Group>
<Group Id="Ribbon.MyWPTab.MyWPGroupManage"
Description="Manage group description"
Title="Manage"
Command="MyWPContextualTab.EnableMyWPGroupManage"
Sequence="53"
Template="Ribbon.Templates.MyWPTemplate">
<Controls Id="Ribbon.MyWP.Manage.Controls">
<Button Id="Ribbon.MyWP.Manage.ViewItem"
Command="MyWP.Cmd.ViewItem"
Description="View this item"
LabelText="View Item"
TemplateAlias="ONERW"
Sequence="5"
Image32by32="_layouts/images/MyWP/ribbon/viewitem-32.png"
Image16by16="_layouts/images/MyWP/ribbon/viewitem-16.png" />
<Button Id="Ribbon.MyWP.Manage.EditItem"
Command="MyWP.Cmd.EditItem"
Description="Edit this item"
LabelText="Edit Item"
TemplateAlias="ONERW"
Sequence="10"
Image32by32="_layouts/images/MyWP/ribbon/edititem-32.png"
Image16by16="_layouts/images/MyWP/ribbon/edititem-16.png" />
<Button Id="Ribbon.MyWP.Manage.VersionHistory"
Command="MyWP.Cmd.VersionHistory"
Description="Version History"
LabelText="Version History"
TemplateAlias="THRRW"
Sequence="15"
Image32by32="_layouts/images/MyWP/ribbon/versionhistory-32.png"
Image16by16="_layouts/images/MyWP/ribbon/versionhistory-16.png" />
<Button Id="Ribbon.MyWP.Manage.ItemPermissions"
Command="MyWP.Cmd.ItemPermissions"
Description="Item Permissions"
LabelText="Item Permissions"
TemplateAlias="THRRW"
Sequence="20"
Image32by32="_layouts/images/MyWP/ribbon/itempermissions-32.png"
Image16by16="_layouts/images/MyWP/ribbon/itempermissions-16.png" />
<Button Id="Ribbon.MyWP.Manage.DeleteItem"
Command="MyWP.Cmd.DeleteItem"
Description="Delete Item"
LabelText="Delete Item"
TemplateAlias="THRRW"
Sequence="25"
Image32by32="_layouts/images/MyWP/ribbon/deleteitem-32.png"
Image16by16="_layouts/images/MyWP/ribbon/deleteitem-16.png" />
<Button Id="Ribbon.MyWP.Manage.Comments"
Command="MyWP.Cmd.Comments"
Description="Comments"
LabelText="Comments"
TemplateAlias="ONERW"
Sequence="30"
Image32by32="_layouts/images/MyWP/ribbon/comments-32.ico"
Image16by16="_layouts/images/MyWP/ribbon/comments-16.png" />
</Controls>
</Group>
<Group Id="Ribbon.MyWPTab.MyWPGroupViews"
Description="Views group description"
Title="Views"
Command="MyWPContextualTab.EnableMyWPGroupViews"
Sequence="54"
Template="Ribbon.Templates.MyWPTemplate">
<Controls Id="Ribbon.MyWP.Views.Controls">
<Button Id="Ribbon.MyWP.Views.SaveView"
Command="MyWP.Cmd.SaveView"
Description="Save View"
LabelText="Save View"
TemplateAlias="THRRW"
Image32by32="_layouts/images/MyWP/ribbon/saveview-32.png"
Image16by16="_layouts/images/MyWP/ribbon/saveview-16.png" />
<Button Id="Ribbon.MyWP.Views.RenameView"
Command="MyWP.Cmd.RenameView"
Description="Rename View"
LabelText="Rename View"
TemplateAlias="THRRW"
Image32by32="_layouts/images/MyWP/ribbon/renameview-32.png"
Image16by16="_layouts/images/MyWP/ribbon/renameview-16.png" />
<Button Id="Ribbon.MyWP.Views.DeleteView"
Command="MyWP.Cmd.DeleteView"
Description="Delete View"
LabelText="Delete View"
TemplateAlias="THRRW"
Image32by32="_layouts/images/MyWP/ribbon/deleteview-32.png"
Image16by16="_layouts/images/MyWP/ribbon/deleteview-16.png" />
<Label Id="Ribbon.MyWP.Views.CurrentViewLabel"
LabelText="Current View:"
ForId="Ribbon.MyWP.Views.CurrentViewDropDown"
TemplateAlias="THRRW" />
<DropDown Id="Ribbon.MyWP.Views.CurrentViewDropDown"
Command="MyWP.Cmd.CurrentViewDropDown"
PopulateDynamically="true"
PopulateQueryCommand="MyWP.Cmd.CurrentViewDropDown.Populate"
TemplateAlias="THRRW" />
<Button Id="Ribbon.MyWP.Views.SelectColoumns"
Command="MyWP.Cmd.SelectColoumns"
Description="Select Coloumns"
LabelText="Select Coloumns"
TemplateAlias="THRRW"
Image32by32="_layouts/images/MyWP/ribbon/selectcoloumns-32.png"
Image16by16="_layouts/images/MyWP/ribbon/selectcoloumns-16.png" />
<Button Id="Ribbon.MyWP.Views.ShowHideFilters"
Command="MyWP.Cmd.ShowHideFilters"
Description="Show/Hide Filters"
LabelText="Show/Hide Filters"
TemplateAlias="THRRW"
Image32by32="_layouts/images/MyWP/ribbon/showhidefilters-32.png"
Image16by16="_layouts/images/MyWP/ribbon/showhidefilters-16.png" />
<Button Id="Ribbon.MyWP.Views.ViewCompletedItems"
Command="MyWP.Cmd.ViewCompletedItems"
Description="View Completed Items"
LabelText="View Completed Items"
TemplateAlias="THRRW"
Image32by32="_layouts/images/MyWP/ribbon/viewcompleteditems-32.png"
Image16by16="_layouts/images/MyWP/ribbon/viewcompleteditems-16.png" />
<Button Id="Ribbon.MyWP.Views.ClearCompletedItems"
Command="MyWP.Cmd.ClearCompletedItems"
Description="Clear Completed Items"
LabelText="Clear Completed Items"
TemplateAlias="THRRW"
Image32by32="_layouts/images/MyWP/ribbon/clearcompleteditems-32.png"
Image16by16="_layouts/images/MyWP/ribbon/clearcompleteditems-16.png" />
</Controls>
</Group>
<Group Id="Ribbon.MyWPTab.MyWPGroupShareTrack"
Description="Group description"
Title="Share & Track"
Command="MyWPContextualTab.EnableMyWPGroupShareTrack"
Sequence="55"
Template="Ribbon.Templates.MyWPTemplate">
<Controls Id="Ribbon.MyWP.ShareTrack.Controls">
<Button Id="Ribbon.MyWP.ShareTrack.AlertMe"
Command="MyWP.Cmd.AlertMe"
Description="Alert Me"
LabelText="Alert Me"
TemplateAlias="ONERW"
Image32by32="_layouts/images/MyWP/ribbon/alertme-32.png"
Image16by16="_layouts/images/MyWP/ribbon/alertme-16.png" />
</Controls>
</Group>
<Group Id="Ribbon.MyWPTab.MyWPGroupWorkflows"
Description="Group description"
Title="Workflows"
Command="MyWPContextualTab.EnableMyWPGroupWorkflows"
Sequence="56"
Template="Ribbon.Templates.MyWPTemplate">
<Controls Id="Ribbon.MyWP.Workflows.Controls">
<Button Id="Ribbon.MyWP.Workflows.Workflows"
Command="MyWP.Cmd.Workflows"
Description="Workflows"
LabelText="Workflows"
TemplateAlias="ONERW"
Image32by32="_layouts/images/MyWP/ribbon/workflows-32.png"
Image16by16="_layouts/images/MyWP/ribbon/workflows-16.png" />
<Button Id="Ribbon.MyWP.Workflows.ApproveReject"
Command="MyWP.Cmd.ApproveReject"
Description="Approve Reject"
LabelText="Approve Reject"
TemplateAlias="ONERW"
Image32by32="_layouts/images/MyWP/ribbon/approvereject-32.png"
Image16by16="_layouts/images/MyWP/ribbon/approvereject-16.png" />
</Controls>
</Group>
</Groups>
</Tab>
</ContextualGroup>
Definition for Contextual Tab:
<GroupTemplate Id="Ribbon.Templates.MyWPTemplate">
<Layout Title="MyWPLayout"
LayoutTitle="MyWPLayout">
<OverflowSection Type="OneRow"
DisplayMode="Large"
TemplateAlias="ONERW" />
<OverflowSection Type="ThreeRow"
DisplayMode="Medium"
TemplateAlias="THRRW" />
</Layout>
</GroupTemplate>
MyWPContextualTabWebComponent.js:
Type.registerNamespace('ContextualTabWebPart');
var _webPartPageComponentId;
ContextualTabWebPart.CustomPageComponent = function ContextualTabWebPart_CustomPageComponent(webPartPcId, gridId)
{
this._webPartPageComponentId = webPartPcId;
this.$gridId = gridId;
ContextualTabWebPart.CustomPageComponent.initializeBase(this);
}
ContextualTabWebPart.CustomPageComponent.prototype = {
$gridId: null,
init: function ContextualTabWebPart_CustomPageComponent$init() { },
getFocusedCommands: function ContextualTabWebPart_CustomPageComponent$getFocusedCommands()
{
return [
'MyWPContextualTab.EnableMyWPTab',
'MyWPContextualTab.EnableMyWPGroupNew',
'MyWP.Cmd.NewItem',
'MyWPContextualTab.EnableMyWPGroupManage',
'MyWP.Cmd.ViewItem',
'MyWP.Cmd.EditItem',
'MyWP.Cmd.VersionHistory',
'MyWP.Cmd.ItemPermissions',
'MyWP.Cmd.DeleteItem',
'MyWP.Cmd.Comments',
'MyWPContextualTab.EnableMyWPGroupViews',
'MyWP.Cmd.SaveView',
'MyWP.Cmd.RenameView',
'MyWP.Cmd.DeleteView',
'MyWP.Cmd.CurrentViewDropDown',
'MyWP.Cmd.CurrentViewDropDown.Populate',
'MyWP.Cmd.SelectColoumns',
'MyWP.Cmd.ShowHideFilters',
'MyWP.Cmd.ViewCompletedItems',
'MyWP.Cmd.ClearCompletedItems',
'MyWPContextualTab.EnableMyWPGroupShareTrack',
'MyWP.Cmd.AlertMe',
'MyWPContextualTab.EnableMyWPGroupWorkflows',
'MyWP.Cmd.Workflows',
'MyWP.Cmd.ApproveReject'];
},
getGlobalCommands: function ContextualTabWebPart_CustomPageComponent$getGlobalCommands()
{
return [];
},
isFocusable: function ContextualTabWebPart_CustomPageComponent$isFocusable()
{
return true;
},
canHandleCommand: function ContextualTabWebPart_CustomPageComponent$canHandleCommand(commandId)
{
//Contextual Tab commands
var commands = [
'MyWPContextualTab.EnableMyWPTab',
'MyWPContextualTab.EnableMyWPGroupNew',
'MyWP.Cmd.NewItem',
'MyWPContextualTab.EnableMyWPGroupManage',
'MyWP.Cmd.ViewItem',
'MyWP.Cmd.EditItem',
'MyWP.Cmd.VersionHistory',
'MyWP.Cmd.ItemPermissions',
'MyWP.Cmd.DeleteItem',
'MyWP.Cmd.Comments',
'MyWPContextualTab.EnableMyWPGroupViews',
'MyWP.Cmd.SaveView',
'MyWP.Cmd.RenameView',
'MyWP.Cmd.DeleteView',
'MyWP.Cmd.CurrentViewDropDown',
'MyWP.Cmd.CurrentViewDropDown.Populate',
'MyWP.Cmd.SelectColoumns',
'MyWP.Cmd.ShowHideFilters',
'MyWP.Cmd.ViewCompletedItems',
'MyWP.Cmd.ClearCompletedItems',
'MyWPContextualTab.EnableMyWPGroupShareTrack',
'MyWP.Cmd.AlertMe',
'MyWPContextualTab.EnableMyWPGroupWorkflows',
'MyWP.Cmd.Workflows',
'MyWP.Cmd.ApproveReject'];
for (var i = 0; i < commands.length; i++)
{
if (commandId === commands[i]) return true;
}
},
handleCommand: function ContextualTabWebPart_CustomPageComponent$handleCommand(commandId, properties, sequence)
{
if (commandId === 'MyWP.Cmd.NewItem') doActionOnItem(this.$gridId, 'new');
if (commandId === 'MyWP.Cmd.ViewItem') doActionOnItem(this.$gridId, 'view');
if (commandId === 'MyWP.Cmd.EditItem') doActionOnItem(this.$gridId, 'edit');
if (commandId === 'MyWP.Cmd.VersionHistory') doActionOnItem(this.$gridId, 'version');
if (commandId === 'MyWP.Cmd.ItemPermissions') doActionOnItem(this.$gridId, 'perms');
if (commandId === 'MyWP.Cmd.DeleteItem') doActionOnItem(this.$gridId, 'delete');
if (commandId === 'MyWP.Cmd.Comments') doActionOnItem(this.$gridId, 'comments');
if (commandId === 'MyWP.Cmd.AlertMe') doActionOnItem(this.$gridId, 'subscribe');
if (commandId === 'MyWP.Cmd.Workflows') doActionOnItem(this.$gridId, 'workflows');
if (commandId === 'MyWP.Cmd.ApproveReject') doActionOnItem(this.$gridId, 'approve');
if (commandId === 'MyWP.Cmd.ClearCompletedItems') doActionOnItem(this.$gridId, 'clear-completed');
},
getId: function ContextualTabWebPart_CustomPageComponent$getId()
{
return this._webPartPageComponentId;
}
}
ContextualTabWebPart.CustomPageComponent.registerClass('ContextualTabWebPart.CustomPageComponent', CUI.Page.PageComponent);
SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs("MyWPContextualTabPageComponent.js");

Whenever you are calling the js function, write this line:
SP.SOD.executeOrDelayUntilScriptLoaded([YOUR JS FUNCTION HERE], ""sp.ribbon.js"");
This will wait for the ribbon js to load and then execute your js function. See if this helps!

Related

Combining context menu with custom interface in Excel 365

I need to combine a custom ribbon with a context menu in an Excel file. I have been using custom ribbons and context menus with RibbonX separately for several years.
The code below doesn't seem to load either of them.
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
<tabs>
<tab id="MyCustomTab" label="Client Tool" insertAfterMso="TabTEAM">
<group id="customGroup1" label="Add">
<button id="customButton1" label="New Product" size="large" onAction="NewProduct" />
<separator id="MySeparator1" />
<button id="customButton2" label="New Column" size="large" onAction="NewColumn" />
</group>
</tab>
</tabs>
</ribbon>
<contextMenus>
<contextMenu idMso="ContextMenuCell">
<menu id="MySubMenu" label="Client Menu" insertBeforeMso="Cut" image="clientlogo" >
<button id="Menu1Button1" label="Set as Relevant"
imageMso="AppointmentColor0" onAction="UpperMacro"/>
<button id="Menu1Button2" label="Set as Irrelevant"
imageMso="AppointmentColor4" onAction="LowerMacro"/>
</menu>
<menuSeparator id="MySeparator" insertBeforeMso="Cut" />
</contextMenu>
</contextMenus>
</customUI>

Excel Custom UI Editor For Microsoft Office Resizable buttons

I am trying to create custom ribbon tab in Excel with resizable buttons, based on the size of the window. I am using Custom UI Editor For Microsoft Office. I would like that the buttons will change to small when I shrink Excel, like they do in other tabs. The code that I wrote in Custom UI Editor For Microsoft Office is below. Here size is defined as large. Is it possible to set it as auto so it will change automatically based on the size of the window?
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
<tabs>
<tab id="CustomTab" label="Custom Tab" insertAfterMso="TabView">
<group id="ImportRequestGroup" label="Import Requests" imageMso="Refresh">
<button id="RefreshButton" label="Refresh" size="large" onAction="RefreshAction" imageMso="Refresh" />
<button id="ImportRequestButton" label="Import Requests" size="large" onAction="ImportRequestAction" imageMso="OutlineDemoteToBodyText" />
</group>
<group id="ShowViewsGroup" label="Show views" imageMso="FrameCreateLeft">
<button id="ShowCalanderButton" label="Show Calander" size="large" onAction="ShowCalanderAction" imageMso="FrameCreateLeft" />
<button id="ViewPlanButton" label="View Plan" size="large" onAction="ViewPlanAction" imageMso="ViewFullScreenView" />
<button id="SortPlanButton" label="Sort Plan" size="large" onAction="SortPlanAction" imageMso="Bullets" />
<button id="FilterNoneButton" label="Filter none" size="large" onAction="FilterNoneAction" imageMso="FilterToggleFilter" />
<button id="HideAbsenceButton" label="Hide Absence" size="large" onAction="HideAbsenceAction" imageMso="CharacterBorder" />
</group>
<group id="ManageRowsGroup" label="Manage rows" imageMso="ActionInsertAccess">
<button id="InsertRowButton" label="Insert Row" size="large" onAction="InsertRowAction" imageMso="ActionInsertAccess" />
<button id="MoveToArchaveButton" label="Move to Archave" size="large" onAction="MoveToArchaveAction" imageMso="SourceControlCheckOut" />
</group>
<group id="EmailReportsGroup" label="Email reports" imageMso="ChangesDiscardAndRefresh">
<button id="CalculateDifferenceButton" label="Calculate Difference" size="large" onAction="CalculateDifferenceAction" imageMso="ChangesDiscardAndRefresh" />
<button id="DaysReminderButton" label="5 days Reminder" size="large" onAction="DaysReminderAction" imageMso="MailMergeStartEmail" />
</group>
<group id="ReportsGroup" label="Reports" imageMso="AcceptInvitation">
<button id="ApprovePlanButton" label="Approve Plan" size="large" onAction="ApprovePlanAction" imageMso="AcceptInvitation" />
<button id="Report14DaysButton" label="Report 14 days" size="large" onAction="Report14DaysAction" imageMso="ChooseForm" />
<button id="ReportTechnicianButton" label="Report Technician" size="large" onAction="ReportTechnicianAction" imageMso="CompareAndCombine" />
<button id="WeeklyViewButton" label="Weekly View" size="large" onAction="WeeklyViewAction" imageMso="GroupMarginsAndPadding" />
</group>
<group id="CheckDuplicatesGroup" label="Check duplicates" imageMso="OutlineUngroupMenu">
<button id="CheckEquipmenButton" label="Check Equipmen" size="large" onAction="CheckEquipmenAction" imageMso="OutlineUngroupMenu" />
<button id="CheckTechnicianButton" label="Check Technician" size="large" onAction="CheckTechnicianAction" imageMso="SharingOpenWssTaskList" />
</group>
<group id="SpotfireFilesGroup" label="Spotfire files" imageMso="Chart3DColumnChart">
<button id="SpotfirePlanAndArchiveButton" label="Spotfire Plan and Archive" size="large" onAction="SpotfirePlanAndArchiveAction" imageMso="Chart3DColumnChart" />
<button id="SpotfireRealizationReportButton" label="Spotfire Realization Report" size="large" onAction="SpotfireRealizationReportAction" imageMso="SharingOpenWssContactList" />
</group>
<group id="FormatingGroup" label="Formating" imageMso="AutoFormat">
<button id="ConditionalFormatingButton" label="Conditional Formating" size="large" onAction="ConditionalFormating" imageMso="AutoFormat" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
I tried to find the solution online with no luck.
Resizing custom controls is only available for Office 2010 and later. The functionality is somewhat limited for custom controls (as opposed to what Microsoft does with their own controls).
The capability can only be applied to group controls, not individual controls. The command is an attribute of the <group> tag. Example:
<group id="ImportRequestGroup" autoScale="true" label="Import Requests" imageMso="Refresh">
Microsoft Documentation reference:
https://learn.microsoft.com/en-us/previous-versions/office/developer/office-2010/ee691834(v=office.14)?redirectedfrom=MSDN#auto-scaling-of-custom-controls

Create a multilevel submenu in Visual Studio Tools menu

Create a multilevel submenu in Visual Studio Tools menu
I am looking to create a multilevel menu within the Visual Studio Tools menu.
I would want the structure as seen to be something like below.
Tools
|->GC
|->Licenses--------------------------->|
|->Samples |-> Activate
|-> Deactivate
From the below code in the .vsct file, I am able to get to the structure as below
Tools|
|->GC->|
|->Licenses
|->Samples.
How would I be able to add a submenu "Licenses" into the GC menu and add the Activate/Deactivate buttons to it?
<CommandTable xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<Extern href="stdidcmd.h"/>
<Extern href="vsshlids.h"/>
<Commands package="guidComponentOneMenuPackage">
<Menus>
<Menu guid="guidComponentOneMenuPackageCmdSet" id="TopLevelMenu" priority="0x700" type="Menu">
<Parent guid="guidSHLMainMenu" id="IDG_VS_TOOLS_EXT_TOOLS" />
<Strings>
<ButtonText>GC</ButtonText>
<CommandName>GC</CommandName>
</Strings>
</Menu>
</Menus>
<Groups>
<Group guid="guidComponentOneMenuPackageCmdSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="guidComponentOneMenuPackageCmdSet" id="TopLevelMenu"/>
</Group>
</Groups>
<Buttons>
<Button guid="guidComponentOneMenuPackageCmdSet" id="LicenseManagerId" priority="0x0100" type="Button">
<Parent guid="guidComponentOneMenuPackageCmdSet" id="MyMenuGroup" />
<Icon guid="guidImages" id="bmpPic1" />
<Strings>
<ButtonText>Licenses</ButtonText>
</Strings>
</Button>
<Button guid="guidComponentOneMenuPackageCmdSet" id="SamplesExplorerId" priority="0x0101" type="Button">
<Parent guid="guidComponentOneMenuPackageCmdSet" id="MyMenuGroup" />
<Icon guid="guidImages" id="bmpPic1" />
<Strings>
<ButtonText>Samples</ButtonText>
</Strings>
</Button>
</Buttons>
<Bitmaps>
<Bitmap guid="guidImages" href="Resources\GC.png" usedList="bmpPic1"/>
</Bitmaps>
</Commands>
<Symbols>
<GuidSymbol name="guidComponentOneMenuPackage" value="{458b53ac-7a4e-440d-aebf-d3eec4fd24e2}" />
<GuidSymbol name="guidComponentOneMenuPackageCmdSet" value="{d2b0b608-ab47-47c6-a9a3-d0cf3b64157b}">
<IDSymbol name="MyMenuGroup" value="0x1020" />
<IDSymbol name="LicenseManagerId" value="0x0100" />
<IDSymbol name="SamplesExplorerId" value="0x0101" />
<IDSymbol name="TopLevelMenu" value="0x1021"/>
</GuidSymbol>
<GuidSymbol name="guidImages" value="{6e5edeb3-274c-4147-a06d-7f50f10160b9}" >
<IDSymbol name="bmpPic1" value="1" />
</GuidSymbol>
</Symbols>
</CommandTable>
We will be able to create multilevel menus by merely adding more groups and setting their priority as below.
<CommandTable xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-18 /CommandTable" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<Extern href="stdidcmd.h"/>
<Extern href="vsshlids.h"/>
<Commands package="guidComponentOneMenuPackage">
<Menus>
<Menu guid="guidComponentOneMenuPackageCmdSet" id="TopLevelMenu" priority="0x700" type="Menu">
<Parent guid="guidSHLMainMenu" id="IDG_VS_TOOLS_EXT_TOOLS" />
<Strings>
<ButtonText>GC</ButtonText>
<CommandName>GC</CommandName>
</Strings>
</Menu>
<Menu guid="guidComponentOneMenuPackageCmdSet" id="GCMenu" priority="0x0200" type="Menu">
<Parent guid="guidComponentOneMenuPackageCmdSet" id="MyMenuGroup" />
<Strings>
<ButtonText>Main</ButtonText>
<CommandName>Main</CommandName>
</Strings>
</Menu>
</Menus>
<Groups>
<Group guid="guidComponentOneMenuPackageCmdSet" id="GCGroup" priority="0x0600">
<Parent guid="guidComponentOneMenuPackageCmdSet" id="GCMenu"/>
</Group>
<Group guid="guidComponentOneMenuPackageCmdSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="guidComponentOneMenuPackageCmdSet" id="TopLevelMenu"/>
</Group>
</Groups>
<Buttons>
<Button guid="guidComponentOneMenuPackageCmdSet" id="LicenseManagerId" priority="0x0201" type="Button">
<Parent guid="guidComponentOneMenuPackageCmdSet" id="GCGroup" />
<Icon guid="guidImages" id="bmpPic1" />
<Strings>
<ButtonText>Licenses</ButtonText>
</Strings>
</Button>
<Button guid="guidComponentOneMenuPackageCmdSet" id="SamplesExplorerId" priority="0x0202" type="Button">
<Parent guid="guidComponentOneMenuPackageCmdSet" id="GCGroup" />
<Icon guid="guidImages" id="bmpPic1" />
<Strings>
<ButtonText>Samples</ButtonText>
</Strings>
</Button>
</Buttons>
<Bitmaps>
</Bitmaps>
</Commands>
<Symbols>
<IDSymbol name="MyMenuGroup" value="0x1020" />
<IDSymbol name="GCGroup" value="0x0202" />
<IDSymbol name="LicenseManagerId" value="0x0100" />
<IDSymbol name="SamplesExplorerId" value="0x0101" />
<IDSymbol name="TopLevelMenu" value="0x1021"/>
<IDSymbol name="GCMenu" value="0x1022"/>
</GuidSymbol>
</Symbols>
</CommandTable>

How to bind dropdownlist in radgrid

I am new to use telerik controls. I want to bind data in dropdownlist that is in telerik RadGrid control. I have already been applied but it gives an error
Object reference not set to an instance of an object.
Here is my code given below :
Source code
<telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="false" AllowPaging="true"
OnNeedDataSource="RadGrid1_NeedDataSource" OnUpdateCommand="RadGrid1_UpdateCommand"
OnItemCreated="RadGrid1_ItemCreated" OnDeleteCommand="RadGrid1_DeleteCommand"
OnInsertCommand="RadGrid1_InsertCommand"
onitemdatabound="RadGrid1_ItemDataBound" >
<MasterTableView DataKeyNames="id" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage">
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" />
<telerik:GridBoundColumn DataField="id" HeaderText="ID" ReadOnly="true"
ForceExtractValue="Always" ConvertEmptyStringToNull="true" />
<telerik:GridTemplateColumn>
<ItemTemplate>
<asp:DropDownList ID="ddldept" DataTextField="name" DataValueField="id" runat="server"></asp:DropDownList>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="code" HeaderText="Branch Code" />
<telerik:GridBoundColumn DataField="name" HeaderText="Branch Name" />
<telerik:GridBoundColumn DataField="shortname" HeaderText="Branch Shorth Name" />
<telerik:GridBoundColumn DataField="hod" HeaderText="Head of Department"/>
<telerik:GridBoundColumn DataField="location" HeaderText="Location Address" />
<telerik:GridButtonColumn ConfirmText="Are you sure want to delete this Branch?" ConfirmDialogType="RadWindow"
ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" />
</Columns>
<EditFormSettings>
<EditColumn ButtonType="ImageButton" />
</EditFormSettings>
</MasterTableView>
<PagerStyle Mode="NextPrevAndNumeric" />
<ClientSettings>
<ClientEvents OnRowDblClick="rowDblClick" />
</ClientSettings>
</telerik:RadGrid>
Main Code
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
DataTable dt=obj.display_branch();
GridEditableItem item = e.Item as GridEditableItem;
DropDownList list = item.FindControl("ddldept") as DropDownList;
list.DataSource = dt;
list.DataTextField = "name";
list.DataValueField = "id";
list.DataBind();
}
Try on RadGrid1_ItemCreated. That is how I achieved it.

Ribbon Contextual Groups and Tabs in SharePoint

I am new to SharePoint ribbon. Why do I not see the View and Edit buttons in the Manage group of my tab?
Here are my definitions for your reference:
<ContextualGroup Id="Ribbon.MyWorkContextualTabGroup"
Color="Blue" Title="{title}"
Command="MyWorkContextualTab.EnableContextualGroup"
Sequence="502"
ContextualGroupId="MyWorkContextualTabGroup">
<Tab Id="Ribbon.MyWorkTab"
Title="My Work"
Description="My Work tab description"
Command="MyWorkContextualTab.EnableMyWorkTab"
Sequence="501">
<Scaling Id="Ribbon.MyWorkTab.Scaling">
<MaxSize Id="Ribbon.MyWorkTab.MaxSize_New"
GroupId="Ribbon.MyWorkTab.MyWorkGroup_New"
Size="MyWorkLayout"
Sequence="10"/>
<MaxSize Id="Ribbon.MyWorkTab.MaxSize_Manage"
GroupId="Ribbon.MyWorkTab.MyWorkGroup_Manage"
Size="MyWorkLayout"
Sequence="20" />
<Scale Id="Ribbon.MyWorkTab.Scalling.MyWorkTabScalling_New"
GroupId="Ribbon.MyWorkTab.MyWorkGroup_New"
Size="MyWorkLayout"
Sequence="30" />
<Scale Id="Ribbon.MyWorkTab.Scalling.MyWorkTabScalling_Manage"
GroupId="Ribbon.MyWorkTab.MyWorkGroup_Manage"
Size="MyWorkLayout"
Sequence="40"/>
</Scaling>
<Groups Id="Ribbon.MyWorkTab.Groups">
<Group Id="Ribbon.MyWorkTab.MyWorkGroup_New"
Description="New group description"
Title="New"
Command="MyWorkContextualTab.EnableMyWorkGroup_New"
Sequence="52"
Template="Ribbon.Templates.MyWorkTemplate">
<Controls Id="Ribbon.MyWorkTab.MyWorkGroup_New.Controls">
<Button Id="Ribbon.MyWorkTab.MyWorkGroup_New.NewItem"
Command="MyWorkContextualTab.NewItemCommand"
Sequence="15"
Description="Add a new item"
LabelText="New Item"
TemplateAlias="ONE_R1"
Image32by32="_layouts/images/mywork/ribbon/newitem.png" />
</Controls>
</Group>
<Group Id="Ribbon.MyWorkTab.MyWorkGroup_Manage"
Description="Manage group description"
Title="Manage"
Command="MyWorkContextualTab.EnableMyWorkGroup_Manage"
Sequence="53"
Template="Ribbon.Templates.MyWorkTemplate">
<Controls Id="Ribbon.MyWorkTab.MyWorkGroup_Manage.Controls">
<Button Id="Ribbon.MyWorkTab.MyWorkGroup_Manage.ViewItem"
Command="MyWorkContextualTab.ViewItemCommand"
Sequence="25"
Description="View this item"
LabelText="View Item"
TemplateAlias="ONE_R1"
Image32by32="_layouts/images/mywork/ribbon/viewitem.png" />
<Button Id="Ribbon.MyWorkTab.MyWorkGroup_Manage.EditItem"
Command="MyWorkContextualTab.EditItemCommand"
Sequence="35"
Description="Edit this item"
LabelText="Edit Item"
TemplateAlias="ONE_R1"
Image32by32="_layouts/images/mywork/ribbon/edititem.png" />
</Controls>
</Group>
</Groups>
</Tab>
</ContextualGroup>
<GroupTemplate Id="Ribbon.Templates.MyWorkTemplate">
<Layout Title="MyWorkLayout" LayoutTitle="MyWorkLayout">
<Section Alignment="Top" Type="OneRow">
<Row>
<ControlRef DisplayMode="Large" TemplateAlias="ONE_R1"/>
</Row>
</Section>
<Section Alignment="Top" Type="ThreeRow">
<Row>
<ControlRef DisplayMode="Medium" TemplateAlias="THE_R1"/>
</Row>
<Row>
<ControlRef DisplayMode="Medium" TemplateAlias="THE_R2"/>
</Row>
<Row>
<ControlRef DisplayMode="Medium" TemplateAlias="THE_R3"/>
</Row>
</Section>
</Layout>
</GroupTemplate>
I havent worked with Sharepoint's Ribbon much, but from what I understand it is almost identical to CRM 2011 ribbon structure. When the issue of missing buttons crop up in CRM it is usually a sequence issue with Scaling and MaxSize.
All of the MaxSize element need to come before the Scale elements in terms of sequence. I would try adding the sequence numbers to the MaxSize/Scale elements in your Scaling section and adjust the numbers to make sure maxsize appears before scale.
Hope this helps.
example:
<Scaling Id="Ribbon.MyWorkTab.Scaling">
<MaxSize Id="Ribbon.MyWorkTab.MaxSize_New"
GroupId="Ribbon.MyWorkTab.MyWorkGroup_New"
Size="MyWorkLayout"
Sequence="10"/>
<MaxSize Id="Ribbon.MyWorkTab.MaxSize_Manage"
GroupId="Ribbon.MyWorkTab.MyWorkGroup_Manage"
Size="MyWorkLayout"
Sequence="20" />
<Scale Id="Ribbon.MyWorkTab.Scalling.MyWorkTabScalling_New"
GroupId="Ribbon.MyWorkTab.MyWorkGroup_New"
Size="MyWorkLayout"
Sequence="30" />
<Scale Id="Ribbon.MyWorkTab.Scalling.MyWorkTabScalling_Manage"
GroupId="Ribbon.MyWorkTab.MyWorkGroup_Manage"
Size="MyWorkLayout"
Sequence="40"/>
</Scaling>
Okay this is what I had to do:
Do not use _ (underscore) in the Id.
Change my layout to use OverflowSection
Here are my final definitions in case if you need:
<ContextualGroup Id="Ribbon.MyWorkContextualTabGroup"
Color="Blue" Title="{title}"
Command="MyWorkContextualTab.EnableContextualGroup"
Sequence="502"
ContextualGroupId="MyWorkContextualTabGroup">
<Tab Id="Ribbon.MyWorkTab"
Title="My Work"
Description="My Work tab description"
Command="MyWorkContextualTab.EnableMyWorkTab"
Sequence="501">
<Scaling Id="Ribbon.MyWorkTab.Scaling">
<MaxSize Id="Ribbon.MyWorkTab.MaxSizeNew"
GroupId="Ribbon.MyWorkTab.MyWorkGroupNew"
Size="MyWorkLayout"
Sequence="10"/>
<MaxSize Id="Ribbon.MyWorkTab.MaxSizeManage"
GroupId="Ribbon.MyWorkTab.MyWorkGroupManage"
Size="MyWorkLayout"
Sequence="20" />
<Scale Id="Ribbon.MyWorkTab.Scaling.MyWorkTabScalingNew"
GroupId="Ribbon.MyWorkTab.MyWorkGroupNew"
Size="MyWorkLayout"
Sequence="30" />
<Scale Id="Ribbon.MyWorkTab.Scaling.MyWorkTabScalingManage"
GroupId="Ribbon.MyWorkTab.MyWorkGroupManage"
Size="MyWorkLayout"
Sequence="40"/>
</Scaling>
<Groups Id="Ribbon.MyWorkTab.Groups">
<Group Id="Ribbon.MyWorkTab.MyWorkGroupNew"
Description="New group description"
Title="New"
Command="MyWorkContextualTab.EnableMyWorkGroupNew"
Sequence="52"
Template="Ribbon.Templates.MyWorkTemplate">
<Controls Id="Ribbon.MyWorkTab.MyWorkGroupNew.Controls">
<Button Id="Ribbon.MyWorkTab.MyWorkGroupNew.NewItem"
Command="MyWorkContextualTab.NewItemCommand"
Sequence="15"
Description="Add a new item"
LabelText="New Item"
TemplateAlias="ONERW"
Image32by32="_layouts/images/mywork/ribbon/newitem-32.png" />
</Controls>
</Group>
<Group Id="Ribbon.MyWorkTab.MyWorkGroupManage"
Description="Manage group description"
Title="Manage"
Command="MyWorkContextualTab.EnableMyWorkGroupManage"
Sequence="53"
Template="Ribbon.Templates.MyWorkTemplate">
<Controls Id="Ribbon.MyWorkTab.MyWorkGroupManage.Controls">
<Button Id="Ribbon.MyWorkTab.MyWorkGroupManage.ViewItem"
Command="MyWorkContextualTab.ViewItemCommand"
Sequence="25"
Description="View this item"
LabelText="View Item"
TemplateAlias="ONERW"
Image32by32="_layouts/images/mywork/ribbon/viewitem-32.png" />
<Button Id="Ribbon.MyWorkTab.MyWorkGroupManage.EditItem"
Command="MyWorkContextualTab.EditItemCommand"
Sequence="35"
Description="Edit this item"
LabelText="Edit Item"
TemplateAlias="ONERW"
Image32by32="_layouts/images/mywork/ribbon/edititem-32.png" />
</Controls>
</Group>
</Groups>
</Tab>
</ContextualGroup>
<GroupTemplate Id="Ribbon.Templates.MyWorkTemplate">
<Layout Title="MyWorkLayout" LayoutTitle="MyWorkLayout">
<OverflowSection Type="OneRow" DisplayMode="Large" TemplateAlias="ONERW"/>
</Layout>
</GroupTemplate>

Resources