Techsavy
asked on
SharePoint Development help
Hi,
we had a Custom List Context menu Item in "Actions menu" in SP 2007. and below is the class we used for that. Now if I would like to use the same code for SP 2010, then What will be my eqquivalent Code with SP Ribbon. For your Reference I am also including the Custom Action XML that we used in 2007. Basically, this code used to Create a menu item on the "Actions Menu" of either a document Library or any type of list. So, I am looking for a Button on the List Tab, that appears on all List Views for list and all Views of Document Library. When a user Clicks on that Button then the user is directed to a URL mentioned in the Code below. Let me know if it is not clear or need more info.
Custom Action XML:
<CustomAction Id="SomeCustom.Action" Location="Microsoft.ShareP oint.Stand ardMenu" GroupId="ActionsMenu" Sequence="20" ControlAssembly="Some Key" ControlClass="Class mentioned below" />
Class Referenced in Above CustomXML
using System;
using System.Collections.Generic ;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebPa rtPages;
using Microsoft.SharePoint.WebCo ntrols;
namespace MyNameSpace
{
public class MyClass : WebControl
{
protected override void OnLoad(EventArgs e)
{
EnsureChildControls();
base.OnLoad(e);
}
protected override void CreateChildControls()
{
ListViewWebPart listView = FindListView(Parent);
if (listView == null)
return;
MenuItemTemplate menu = new MenuItemTemplate();
menu.Title = "My Title";
menu.Text = "My Title";
menu.Description = "My Description";
menu.ImageUrl = "/_layouts/images/lg_icasa x.gif";
menu.Sequence = 20;
SPWeb web = SPContext.Current.Web;
string urlFormat = "someURL";
string fullUrl = string.Format(urlFormat,
web.Url,
listView.ListName,
listView.ViewGuid,
System.Web.HttpUtility.Url Encode(fil terString)
);
menu.ClientOnClickScript = fullUrl;
Controls.Add(menu);
base.CreateChildControls() ;
}
}
}
Thanks in Advance,
we had a Custom List Context menu Item in "Actions menu" in SP 2007. and below is the class we used for that. Now if I would like to use the same code for SP 2010, then What will be my eqquivalent Code with SP Ribbon. For your Reference I am also including the Custom Action XML that we used in 2007. Basically, this code used to Create a menu item on the "Actions Menu" of either a document Library or any type of list. So, I am looking for a Button on the List Tab, that appears on all List Views for list and all Views of Document Library. When a user Clicks on that Button then the user is directed to a URL mentioned in the Code below. Let me know if it is not clear or need more info.
Custom Action XML:
<CustomAction Id="SomeCustom.Action" Location="Microsoft.ShareP
Class Referenced in Above CustomXML
using System;
using System.Collections.Generic
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebPa
using Microsoft.SharePoint.WebCo
namespace MyNameSpace
{
public class MyClass : WebControl
{
protected override void OnLoad(EventArgs e)
{
EnsureChildControls();
base.OnLoad(e);
}
protected override void CreateChildControls()
{
ListViewWebPart listView = FindListView(Parent);
if (listView == null)
return;
MenuItemTemplate menu = new MenuItemTemplate();
menu.Title = "My Title";
menu.Text = "My Title";
menu.Description = "My Description";
menu.ImageUrl = "/_layouts/images/lg_icasa
menu.Sequence = 20;
SPWeb web = SPContext.Current.Web;
string urlFormat = "someURL";
string fullUrl = string.Format(urlFormat,
web.Url,
listView.ListName,
listView.ViewGuid,
System.Web.HttpUtility.Url
);
menu.ClientOnClickScript = fullUrl;
Controls.Add(menu);
base.CreateChildControls()
}
}
}
Thanks in Advance,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.