动态创建CustomAction

直接上Code:

 

XML
1 <CustomAction

2                 GroupId="PersonalActions"

3                 Id="bac2275f-3512-4ca0-b0c1-6e47907b2bd0"

4                 Location="Microsoft.SharePoint.StandardMenu"

5                 ControlAssembly="你的程序集"

6                 ControlClass="动态创建菜单的类名字"

7                 >

8   </CustomAction>

C#:

 1   public class Menus : System.Web.UI.WebControls.WebControl

 2     {

 3 

 4         protected override void CreateChildControls()

 5         {

 6             

 7                 MenuItemTemplate listItem1 = new MenuItemTemplate();

 8                 listItem1.Text = "测试";

 9                 listItem1.Description = "";

10                 listItem1.ImageUrl = "/_layouts/images/lg_ICASCX.gif";

11                 listItem1.ClientOnClickNavigateUrl = "http://www.google.com";

12                 this.Controls.Add(listItem1);

13 

14         }

15     }

 

 

 

你可能感兴趣的:(action)