Home > General, SharePoint Products and Technology > Add properties to visual webparts sharepoint 2010

Add properties to visual webparts sharepoint 2010


Hi,
This post talks on how one can add custom properties to their SharePoint 2010 visual webparts. Microsoft has brought visual webparts for easing the developer life with SharePoint 2010 development. But when it comes to adding some custom properties for these webparts then there is bit of trouble hidden.
To troubleshoot this issue lets us dive in entities inside webpart project.

  • Inside the webparts folder of the project one can see following files (considering webpart name as “VisualWebPart1”):
  1. Webpart class “VisualWebPart1.cs” that is derived from webpart class
  2. User control file “VisualWebPart1UserControl.ascx” and its associated designer and .cs files

Since we think that merely writing the property and setting its attributes to WebBrowsable=true & Personalizable inside the usercontrol class (VisualWebPart1UserControl.ascx.cs) file will go ahead and add properties into webpart, but in reality this will not work.
So how we gonna do this?
Even though the above assumption of ours is true but its partially true. The fact is, before adding this property to user control class we should
http://www.lamber.info/post/2010/05/21/How-do-I-create-custom-properties-in-Visual-Web-Parts.aspx
http://onlinecoder.blogspot.in/2011/04/custom-properties-in-sharepoint-2010_7158.html

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: