Using visual Studio to create Visual Web Part parts Visual Web Parts is a powerful Web component. It provides built-in designer to create your user interface.
This article explains how to create Visual Web Part parts using visual Studio. Prepare, create a list of your own stats, add some columns, fill in some of the data.
Of The data types of the columns are:
1. Open visual Studio and create a new blank SharePoint Project Smallvillevisualwpproject.
Select Deploy as Farm solution. 2. Right-click the project to add a new item-Visual Web Part playerstats. 3. Right-click the project to add a new class Playerstat.
Click OK. Change code: 4. At this point the file structure should be this:
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvy3jhenlnb2xm/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">
5. Right-click Playerstatsusercontrol.ascx. Select View Code. 6. Drag the corresponding control in the toolbox, the last code such as the following: 7. The design interface should be this:
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvy3jhenlnb2xm/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">
8. Double-click each button to create an event. 9. Double-click PlayerStatsUserControl.ascx.cs to see the code behind it. 10. Add the code for the corresponding event.
The final code should be this: 11. Click Build--Deploy the solution.
12. On the SharePoint site. Click Site Actions-Edit page-Join the Web Part. 13. Select Playerstats in the custom category and click Join. 14. After saving, the interface should be this:
When you click Load, the list information is loaded.
Enter the corresponding data. Click Add, and then click Load.
Click Clear to empty all filled in text.
Creating Visual Web Part parts using visual Studio