Including an extended control in webform

J

Jibber

Sorry for the similar post, but I have clarified the problem a bit more. The
issue is: how do I use an extended .NET control in a webform using VS2005.
In my case, I am overriding the Render for a RadioButtonList control, so I
don't need a user control. So, I just have a very simple class file that
inherits the RadioButtonList and overrides the Render. I am trying to use
this in a Web Site project on a webform.

<%@ Register TagPrefix="MY" TagName="MyRadioButtonList" %>

<MY:MyRadioButtonList ID="myID" Runat="server">
</MY:MyRadioButtonList>

Why doesn't this work?

The compiler doesn't understand the tags and complains. But, when I try to
add a Src attribute, it complains that it has to be a usercontrol. But, it
can't be a user control because its not a Page or UserControl...its a custom
RadioButtonList.
 
G

Guest

Jibber,

You could probably get it to work in a single solution but if you....

1) Split the control into a class library
2) Add the Class library solution to your project
3) Add a Project reference to the Class Library to you web solution
4) Add your @Register line as: <%@ Register Assembly="<ASSEMBLY_NAME"
Namespace="<CONTROL_NAMESPACE>" TagPrefix="MY" %>

Should work. Worked for me and it allows for easier reuse of the control in
other web projects!

Michael
 

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

Top