Inheritance from Control versus Web Control

I read this, which gives an explanation when you select Web Control or Control when creating custom controls, but this is not enough. I have seen that user controls are inherited either because they drop stuff into the user interface.

http://msdn.microsoft.com/en-us/library/yhzc935f.aspx

"If your control displays a user interface (UI) or any other visible element on the client, you should get your control from System.Web.UI.WebControls .. ::. WebControl (or a derived class). If your control displays an element that is not visible in the browser, such as a hidden element or a meta element, takes your control out of System.Web.UI .. ::. Control. The WebControl class comes from the control and adds a style like Font, ForeColor and BackColor In addition, the control that comes from WebControl, works in ASP.NET theme functions without any extra work on your part. "

so the only reason to use WebControl is that you want to use your styling functions? I'm just going to output strings using stringbuilder utlimately, so I don't care. I would prefer to use a straightforward design and rows without tables to form my HTML code, which I need anyway.

+5
source share
3 answers

WebControl does not display tables or anything like that unless you report it. What it has is the style features that most users expect from a control that displays using the user interface.

, . , - .

+2

Control

Control , Control, ViewState.

WebControl

WebControl Control. , WebControl, , , CSS, ..

?

, , Control. , WebControl.

: http://dotnetslackers.com/articles/aspnet/ASPNETCustomControlsPart1.aspx

+10

, ? , MSDN.

0

All Articles