Friday, October 29, 2010

How to Hide SharePoint Column based on user login in Newform.aspx

For last two days i scratch my head, to hide the required column based on the user login in NewForm.aspx and EditForm.aspx of the list. Initially i tried it by using SharePoint designer without using code and later i tried by using inline code but am unable to achieve it , even though i have an option to achieve.

Finally i achieved hiding of share-point column based on user login in NewForm.aspx and EditForm.aspx by creating custom Webpart.

Create a Class Library in Visual studio and add reference 'System.Web', 'Microsoft.SharePoint'. In the class file include the required namespace specify below.







Add the below code

Create the Strong Name Key in Visual Studio and build the project and deploy the code in Assembly and add the Source Safe tag in web.config under which site you want to enable this web part. Now Activate the web-part under Web-part gallery from the top site.

Now add the custom web part in the NewForm or EditForm page where you want to hide the control. That all

To know about Custom Web part Click here

No comments:

Post a Comment