Wednesday 18 November 2015

Custom Visual WebPart in SharePoint 2010

              In this article I'm trying to explain how to create WebPart and how to use that WebPart in SharePoint application. During this we can understood how to work with Custom WebParts. WebParts are introduced in SharePoint in the year of 2003. From there onwards in ASP.net application also MicroSoft introduces to prepare our own Custom WebParts.
 
 
 

 

How to create Custom WebPart and upload into SharePoint site:


              In this article I'm trying to explain how to create WebPart and how to use that WebPart in SharePoint application. During this we can understood how to work with Custom WebParts.

Description:

              WebParts are introduced in SharePoint in the year of 2003. From there onwards in ASP.net application also Microsoft introduces to prepare our own Custom WebParts. Now, we discuss about Custom WebParts and what happen if we use that WebParts in our Site. Using WebParts we can reuse the code logic in our Application and perform the task throughout the Site. For example, in my site I have around 100+ Pages. I want to perform one task that is I want to display the mail information based on login user in all throughout the site in that case I just prepare one Custom WebParts and use that WebParts in SharePoint site. Then automatically that mail information will appear throughout the site.

How to Develop Custom WebParts:

Now, I'm trying to explain how to develop Custom WebParts using SharePoint Package.
Follow below steps to achieve your goal.

Step-1:

Open your project and then right click on solution explorer then choose Add -> NewItem as shown in below fig.
 
 
 
 
 

Step-2:

Then choose SharePoint and then version of that then choose Visual Web Part then give a name for that and then click on Add button for adding WebPart to our project, as shown in below fig.
 

Step-3:

Once WebPart added to our project then design WebPart as you need then deploy the solution. In my example I just simply drag and drop one label control and then I give text for that label control, as shown in below fig.
 
 
 

Step-4:

Once deployed that SharePoint Solution then we can able to access that WebPart into our SharePoint site using Custom WebPart option.

How to Import Custom WebPart into SharePoint Site:

Now, I want to Import my Visual WebPart into my SharePoint site.

Follow below steps to achieve our goal.

Step-1:

 
Open your site Home Page and then choosePage option as shown in below fig and then choose Edit option for editing that site information.
 

Step-2:


After clicking edit option then a new Editing Tools will be enabled there you just choose Insert option then choose WebPart as highlighted in below figure.
 
 
 
 

Step-3:

Once you choose WebPart option then it will list out what are the WebParts available in the site then choose Custom option in Categories then choose your Custom WebPart available in the list then click on Add button for adding WebPart to our site.
 
 
 

Step-4:

Once you click on Add button then it will load for adding the Custom WebPart to your site. As shown in below figure.
 
 
 

Step-5:

After completion of loading then check the site our custom WebPart is appear in the site or not.
 

Step-6:


If we want to do some changes in that WebPart hen move the cursor to above of that WebPart then one dropdown will appear then select that then a list of actions will appear then choose whatever you need and perform the action into that.
 

Step-7:


Now, I choose Edit WebPart option then a new window will appear for editing purpose edit that information then do save changes it will automatically appear in our Site.
 
 
 
 
 

Conclusion:


Hope this article will help you those who are looking for the same and those who are beginners to perform the same task.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

No comments:

Post a Comment