Introducing Custom Controls
page 2 of 6
by . .
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 29709/ 115

What are they?

What are they?

Custom controls are controls that are written 100% in code and are then compiled into a DLL. Then they can be registered and inserted much like a user control. The difference comes into what you can put in them and what you can do with them. They can provide the same high level that server controls do and don't have to be a bunch of other server controls together.

Vs. User Controls

Custom Controls User Controls
  • HTML rendering needs to be coded (no visual designer in VS.NET).
  • Created totally in code and compiled as a complete class library.
  • Easy to distribute and manage.
  • Can have full use of the designer in VS.NET
  • Can be referenced in the implementing page's code.
  • As simple as web forms to create (just drag and drop in VS.NET).
  • Created as an ASP.NET page but stripped and with the .ASCX extension.
    (this is probably over-simplifying it).
  • Sometimes has multiple text files and not as easy to distribute and incorporate.
  • Little to no use of the designer in VS.NET
  • Can't be referenced in the implementing page's code.

Functionality

I said earlier that they had a lot of functionality, and it's true. They can be built with the same functionality as server controls without the limitations of user controls. The downside is that it all has to be done through code, although you will find that it is actually quite simple to do.

For example, you can dynamically set the properties and handle events raised by the custom control, which you can't do in user controls.


View Entire Article

User Comments

Title: Custom vs. User control BLUNDER – user control CAN be referenced in the code.   
Name: Igor Kikena
Date: 2005-03-14 3:53:38 PM
Comment:
Implementing page can reference user control exactly the same way as custom control, otherwise there is really little use for them. And Yes, it does not create user control variable when you drag and drop it on the page, contrary to custom control. So leave your mouse alone and strike the damn keyboard and enjoy user controls in the code behind.

Igor Kikena
Title: Ok..Its a good Topic   
Name: Esha
Date: 2005-03-08 4:47:14 AM
Comment:
I will be better if u give an sample code for building custom control and embedding it in asp webform page
Title: airo   
Name: airo
Date: 2005-01-13 10:13:47 PM
Comment:
Excellent topic and well explained.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2018 ASPAlliance.com  |  Page Processed at 2018-07-22 10:28:55 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search