Interested in Sitecore?

Apply for our Mentorship Program by emailing your resume to chris.williams@techguilds.com. Check out our ASP.NET QuickStart and C# QuckStart Libraries. Below is my latest articles.

Monday, April 14, 2008

WebControls: Overriding RenderContent vs Render

Many examples of creating WebControls will override Render while others override RenderContent. This confused me for the longest time as I didn't really see the difference.
It was only when I was introduced to adapters that I realize why you use one over the other.

If you override RenderContent, then the wrapper tag is created for you. By default its a span but you can use adapters to change it. If instead you override Render, you are responsible for the outer tag and must take into account yourself adapters or force the control user to use your tag.

http://alvinzc.blogspot.com/2006/10/aspnet-basic-of-custom-server-control.html

If you have any tips, tricks, questions about C#, .NET or the like please email them to susan@clinchportal.com

No comments: