To create custom web control, right click on your web project and choose Add New Item. Then, choose Web User Control (i.e., System.Web.UI.UserControl class). Web user control is able to utilize the HTML designer in Visual Studio. So, you will be able to complete the design in a shorter time.
Another way to create custom control is to writing codes by declaring a new control which inherits from CompositeControl or WebControl. But it does not support any visual designer. The biggest challenge is for the graphic designer to touch up the design in C#/VB.Net code because they are not the programmer.
Advantage of using UserControl:
- Easily separate the JavaScript from the web page.
- Easily moving the control around the web page.
- Easier to test the custom web control.
- Easier to share the same control in different design style with other projects.
- Easier to maintain the design with or without using CSS file.
- Reduce the complication of HTML tags within a page.
When to use it?
- You have to display "modal dialogue" box in the page which requires JQuery dialog. This dialog requires a "div" for the dialog and also contains the many data entry fields.
- The "compulsory" aster rick marker in red color.
- The "last updates", "news" or "events" section.
- The banner for header and footer.
- Application menu.
No comments:
Post a Comment