Inherit from a custom CompositeControl
Hi I am hoping for some help.
I have created a composite control that has some basic functions. I would like to be able to take that composite control and reuse the code.
How do I do this? I have created a class and inherited from my cc
public class PasswordTextBox : RoundedTextBox
开发者_如何学编程now if I add another property to the new cc everything is over however nothing is rendered on the page.
What extra steps do I need to do?
Are you sure you've called the base class's render method? Is your RoundedTextBox inheriting from System.Web.UI.Control or System.Web.UI.WebControls.WebControl? I'm presuming it's inheriting from the latter since that's what TextBox derives from.
Protected virtual void RenderContents(HtmlTextWriter Writer)
{
Base.Render(Writer);
}
Take a look at this link and see if it helps: http://www.aspfree.com/c/a/ASP.NET/ASPNET-Custom-Server-Controls-Breaking-the-Secrets-of-Rendering/3/
精彩评论