This article will help you to develop webpart quickly and easily. Remember following things during the werpart development. That will speed up the creation and deployment of the webpart.
Things to remember when creating and deploying webpart to the site:
- Give Assembly name and namespace name for that right click on the project name in solution explorer and select properties. On Application tab give assembly name and namespace name.
- On Build tab in output path give the bin directory path of the site on which you want to deploy the web part.
- Open AssemblyInfo.cs file and add system.security namespace and also add [assembly: AllowPartiallyTrustedCallers()] and then save the file.
- Open the web.config file of the site on which you have to deploy the web part. Site bin directory is under the vitual directories. Path is C:InetpubwwwrootwssVirtualDirectories.
- In web.config file add safecontrol entry under safe controls section.
- Also Change the trust level: and change it to Full (Write Full trust level).
- Deploy the web part.
- When you deploy the web part the dll of the web part that you have created had been created in the bin directory of that site folder under virtual directories.
- On the site go to the web parts section. Click on the site settings menu under site action dropdown list and select web part click new tab and select the web part check mark the web part that you have deployed. And click on populate gallery button now you can add a web part on the web part zone.
- Now you can add the web part on the web part zone.