开发者

Sharepoint2010 hiding "Edit Item" button in ribbon for a specific Custom List

I am using Share Point 2010, I have requirement where i create some Custom lists in feature activation by code and i have to hide "Edit Item" in ribbon for a specific Custom List

T开发者_运维知识库here are so many solutions available but they hide "Edit Item " button for all lists in site , but its not required in my case.

Thank i need your help .. pls

Jay Bhagatwala


Jay

Create UserControl with the following codebehind and add to to a delegate control via Feature using module:

SPRibbon ribbon = SPRibbon.GetCurrent(this.Page);

        if (!Request.Url.ToString().ToLower().Contains("ListNameWhereWeHideButtons"))
            return; // if it's not our list - do nothing

        if (ribbon != null)
        {
            ribbon.TrimById("Ribbon.ListItem.New"); //hide new button
            ribbon.TrimById("Ribbon.ListItem.Manage"); // hide edit button
        } 
    }

I've uploaded my test project on the following URL (I hope it's not prohibited by the rules): http://ge.tt/8TIqVX8

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜