-2

I'm looking at a control that must output raw HTML and provide rich design-time support.

How to create a custom server control, extend the WebControl class and override the Render method?

Can you provide an example?

regards, Blanco

  • It's a question from a MCP test. Wondering how you extend a webcontrol class, overider the render method. An example would be nice. – BlancoBluesman Apr 15 '14 at 10:42
  • You extend a webcontrol class the same way you extend any other class. You override its methods the same way you do any other overridable method. This is why I am asking what your exact problem is. – Chris Apr 15 '14 at 10:43

1 Answers1

0

This will create a control that extends web control and overrides the Render method (though doesn't actually do anything with it.

public class TestControl : System.Web.UI.WebControls.WebControl
{
    protected override void Render(System.Web.UI.HtmlTextWriter writer)
    {
        base.Render(writer);
    }
}

As you can see this is a fairly trivial answer but complete so I suspect that you didn't actually ask the question that you intended to.

Chris
  • 27,210
  • 6
  • 71
  • 92
  • It sounds like you might need to just read up on some of the fundamentals of C#. The above is pretty basic stuff. – Chris Apr 15 '14 at 10:55