Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Using classes inherited from HtmlInput* as custom control

Thread Tools

Using classes inherited from HtmlInput* as custom control
Posts: n/a
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?

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
'Class.inherited' v. 'inherited' syntax inside Class 7stud -- Ruby 11 11-09-2007 06:45 PM
Custom Composite Control inherited from TextBox ASP .Net Building Controls 1 10-24-2006 09:32 PM
User Controls Inherited from a Custom Control share variables? Yuri Vanzine ASP .Net Building Controls 3 07-02-2004 07:55 PM
custom control - reference to contained elements in inherited class Jon Stranger ASP .Net 1 08-24-2003 02:43 PM
ControlDesigner not invoked on custom control when control is rendered within another custom control Matt Sokol ASP .Net Building Controls 2 08-07-2003 07:13 AM