Sunday, March 23, 2014

Adding Custom ECB Menu using VS.Net 2010 to Specific Custom List in SharePoint 2010

Hi Everyone,

I am writing this post to Create Custom ECB menu for specific Custom List.

Step 1- Create a blank SharePoint Project in VS.Net 2010

Step 2- Right click and add new Elements.xml file in your project.
Step 3- Add below code in Elements.xml file...


<?xml version="1.0" encoding="utf-8"?>

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
   Id="My_Custom_ECB_Menu"
   RegistrationType="List"
   RegistrationId="{E38CFA13-44ED-4291-841E-14472D264814}"
   ImageUrl="/_layouts/1033/Images/RTEDCELL.GIF"
   Location="EditControlBlock"
   Sequence="301"
   Title="My Custom ECB Menu Item" >
    <UrlAction Url="~site/default.aspx?ItemId={ItemId}&amp;ListId={ListId}"/>

  </CustomAction>
</Elements>


Please note I used here RegistrationType="List" because I writing this code for List.So this code will attach the menu to all Custom List. And if you want to attach ECB menu to specific list then put List ID in RegistrationId. I also used tag Location="EditControlBlock" which is to add this menu at edit location of list item.


















Step 4- Right click and deploy your project.

View result...









No comments:

Post a Comment

SharePoint Deployment Error : The specified path, file name, or both are too long.

Hi, Sometimes we get surprised with below error while deploying wsp file... Solution : To overcome with this issue, we just ne...