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


Top 5 Contributors of the Month
david stephan

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
Hi,

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

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

Hi,

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   

Hi,

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

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

}
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";
itemToAdd.Update();

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

Thanks,
Bijayani
http://www.mindfiresolutions.com/Sharepoint-Support.htm


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

Hi,

i have created a solution for the same.

http://www.sunilyadav.net/?p=617



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
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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