.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Forum >> SharePoint >> Post New QuestionBookmark and Share Subscribe to Forum

hiding sharepoint list fields for edit/update In Sharepoint

Posted By: William Thompson     Posted Date: April 18, 2010    Points:2   Category :SharePoint

I am planning to create a remedy tracker on MOSS. Here I want to hide or disable few SharePoint list fields for end users to not to edit them. But once they have edit privileges they are able to edit all fields. If any one worked on similar requirement

Author: Faizal             
Posted Date: April 18, 2010     Points: 5   


Make it very simple.......Create content type programatically, create ur fields in content type. If you want to hide the field on edit mode simply write "showineditform=false" like we can declare in display and new forms for a particular field.Do not use any third party ones since they are using control templates you will face big problems.

Author: Sunil Yadav       [Moderator]      
Posted Date: May 21, 2010     Points: 5   


You need to write code logic for this as u need to set visible to valid users for edit.

SPSite site = new SPSite("http://mossserver");
SPWeb web = site.OpenWeb();
SPList selectedList = web.Lists["my list"];
// Colun to hide
selectedList.Fields["Url"].ReadOnlyField = true;

just an idea.

Author: bijayani             
Posted Date: June 24, 2010     Points: 5   

Using Microsoft Sharepoint APIs we can easily Add, Update and Delete list items programmatically. Provided below is a code snippet in C# .Net demonstrating all the three operations..
using (SPSite oSPsite = new SPSite("http://website url/"))
using (SPWeb oSPWeb = oSPsite.OpenWeb())
oSPWeb.AllowUnsafeUpdates = true;

// Fetch the List
SPList list = oSPWeb.Lists["MyList"];

//Add a new item in the List
SPListItem itemToAdd = list.Items.Add();
itemToAdd["Title"] = "Test Title";
itemToAdd["Description"] = "Test Description";

// Get the Item ID
listItemId = itemToAdd.ID;


Author: Sunil Yadav       [Moderator]      
Posted Date: June 24, 2010     Points: 5   


i have created a solution for the same.


Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend