开发者

Inherit from a custom CompositeControl

开发者 https://www.devze.com 2023-01-06 20:10 出处:网络
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.

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/

0

精彩评论

暂无评论...
验证码 换一张
取 消