I am buffing up on ASP.NET Server Controls and a central dilemma seems to be whether to inherit from System.Web.UI.Control or System.Web.UI.WebControls.WebControl. It really seems to boil down to whether you will be presenting visual elements or not. If you are presenting visual elements in your control, you should probably inherit from WebControl. Why? Inheriting from System.Web.UI.Control basically gives you all that you need from the ASP.NET page framework but WebControl gives you the added control of applying styles to your controls as well as Attributes. A couple of these are AddAttributesToRender, ApplyStyle, CopyBaseAttributes, CreateControlStyle, and MergeStyle; none of which are available in Control. Using these methods with the base types and enums from Control (WebControl inherits Control and IAttributeAccessor) you have a very powerful mechanism for developing a Server Control AND a readily available mechanism for making your controls visually pleasing.
Server Control Development Tip #1: Determining Whether to Inherit from Control or WebControl in a Server Control
New on Geeks with Blogs
- Because of AI, You Need a New Development Team
Your existing team is buried in the complexity of your existing product. AI rewards the team with a blank slate. Most companies don't have one.
- The Offshore Problem That Starts With a "Yes"
The stories about offshore "not working" are rarely about skill. They are about an invisible communication gap, and it starts the moment someone says yes.
- The Focus Five: Five Questions to Know If Your Team Is Actually Making Progress
Almost nobody trains you to be an engineering manager. You were good at writing code, so you got handed more people and more meetings, and one day the job was leading a team instead of shipping fea…
- Why Nobody Knows What Engineering Does
At VinSolutions, I was famous for one thing that had nothing to do with writing code. Every single time we shipped a release, I posted about it. On social media, to customers, inside the company, a…
