Posts

Showing posts from August, 2011

Control the render of SharePoint Page

If you want to control the render of SharePoint Page like disable the controls, add new control, hide ribbon menu, ECB Menu….you can user the delegate control to do it: <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%...

Adding/Removing toolbar from custom ListViewWebPart

Refer from: Last week I got a requirement to develop a web part which will display a SharePoint list’s data together with some other content. And the SharePoint list’s data should be displayed same as displayed in the default SharePoint list view. So to display list data, I used SharePoint’s out-of-the-box webpart named ListViewWebPart which can be found in the Microsoft.SharePoint.WebPartPages namespace. Refer following code snippet: public class CustomListViewWebPart : WebPart {   protected override void CreateChildControls()   {     base.CreateChildControls();     //Code to add ListViewWebPart     SPWeb web = SPContext.Current.Web;     SPList list = web.Lists[“CustomListName”];     SPView wpView = list.Views[“ViewName”];     ListViewWebPart _wpListView = new ListViewWebPart();     _wpListView.ID = "_wpListView";     _wpListView.ListName = list.ID.ToStri...