Inheriting From System.Web.UI.Control

R

Ron Vecchi

I am creating a custom control, and pretty green at it too. Now if I
inherit from WebControl I have a bunch of inherited properties that I don't
need and don't care to implement.
So Is there any problems with Inheriting from Control instead of WebControl.
Is designer support still available at design time?

Thanks,
Ron Vecchi
 
A

Alvin Bruney

That is a very suspect approach.

Rather than focussing on what you don't want to implement, you should be
targetting the environment in which the control will be placed. With that
approach, you would choose to inherit from webcontrols if your user control
were to run in a webcontrol environment because this control is optimized
for the environment.

If you don't want the properties, or don't care to implement them, just
ignore them or don't implement them. Either way, the inheritance heirarchy
pretty much dictates that you get all the functionality whether you want it
or not, or whether or not you choose to implement them.

regards
 
J

Jacob Yang [MSFT]

Hi Ron,

In ASP.NET world, there are two base classes for us to author our own
custom controls. One is System.Web.UI.Control, the other is
System.Web.UI.WebControls.WebControl. there are almost same, except that if
we are authoring a control that does not provide UI, or one that combines
other controls that render their own UI, derive from Control. Our custom
control renders UI, derive from WebControl.

Please check the URL below for more details,
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconkeyconceptsinwebfo
rmscontroldevelopment.asp?frame=true

Of course, design-time supports are available in both cases. This article
may be helpful for you,

http://www.intertech-inc.com/DOWNLOADS/presentations/designtimetalk.pdf

Does it answer your question? If I have misunderstood your concern, please
feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top