Monday, February 21, 2011

How Do I Change the render behavior of my custom control from being a span

When writing a custom control it always rendered as an HTML span element. How can I change it for example to a div?

From stackoverflow
  • Derive your control from WebControl as follows:

    public class MyCustomControl : WebControl {
        public MyCustomControl() : base(HtmlTextWriterTag.Div) {}
    }
    

    That is, use the base class constructor that accepts the tag to use.

0 comments:

Post a Comment