Using classes inherited from HtmlInput* as custom control

H

hiriumi

I have an conversion issue from ASP .NET 1.1 to 2.0.

I used to be able to create a class that inherits from any class under
System.Web.UI.HtmlControls and register the namespace in which the
class lives.

In ASP .NET 2.0, the same principle is working if the classes inherit
from System.Web.UI.WebControls.WebControl (or any class that inherits
from WebControl class), but if the class inherits from classes under
System.Web.UI.HtmlControls, I can't seem to use them as the custom tag.

So what I want to do is... let's say I got a class that inherits from
System.Web.UI.HtmlControls.HtmlInputButton and its class name is
MyButtonControl. And the class belongs to MyWebApp namespace. Of
course, MyButtonControl class has some custom code in it. And then, in
one of the .aspx page, I would have the following.

<% Register TagPrefix="MyControls" Namespace="MyWebApp" %>

And then I should be able to use MyButtonControl like the following.

<MyControls:MyButtonControl id="btnWhatever" runat="server" />

What can I do to accomplish this in ASP .NET 2.0?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top