Step-by-Step to create Web Parts by using ASP.net 2.0 - Part I
Now, with the new Web Parts framework introduced with ASP.net 2.0, you can let your users to do customization on your application at the runtime. This framework empowers the users to rearrange the elements of a page by just simply drag and drop the web parts.
I am going to guide you on how to create a web page with web parts, where allows the users to drag and drop it.
1. Create a new form. (Do not use the master page, .master)
2. Drag the WebPartManager from the toolbox and drop it on the form.
You have to add the WebPartManager before you add any web part onto your form. WebPartManager.
There has to be at least one and can be only one WebPartManager control in every page. Basically this is WebPartManager acts as a controller to track the state for all the web parts
3. Create a table (2 rows, 3 columns)
4. Drag 2 WebPartZone control and drop it onto the bottom cells.
When you want to add Web Parts onto the page, you have to include one or more WebPartZone controls. These controls are responsible to set different areas of the page that allow you to add Web Parts.
Now you can add any controls that you want into the WebPartZone
5. Drag a Calendar control from the toolbar onto one of the WebPartZone
6. Drag a Login control from the toolbar onto another WebPartZone
7. You can change the look and feel for your WebPartZone by using the smart tag.
8. Click on the smart tag and select auto format. Select the style you want.
9. Try to run and see your web parts.
You will notice that you only can browse the web parts, the next post I will show you how you can enable your users to design the web parts by drag and drop the web parts onto different web part zone.
Comments
Anonymous
November 21, 2006
Thank you for this.You are very kind.Anonymous
January 03, 2007
This time I am going to show you how to allow your users to add additional webpart onto a web page. This