Problem with .NET 2.0 Website Control

J

Jibber

I have a custom radio button class (MyRadioButtonList) inherited from
System.Web.UI.Controls.RadioButtonList. The control is contained in a
standard class file - not a user control. When I try to use it in a web form
..aspx using the following code, I receive "directive is missing a 'src'
attribute" and "Unknown server tag 'MY:MyRadioButtonList' errors. This
worked in 1.1, but does not work in 2.0 - or possibly just in VS2005. What
am I doing wrong?

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

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

</MY:MyRadioButtonList>
 
J

Jibber

I found the answer:

<compilation debug="true" batch="false">

needs to be placed in the web.config
 
J

Jibber

OK, I thought this worked, but still getting the error. Any ideas? BTW: The
..cs file is located in the App_Code folder of the Web Site.
 
G

Guest

<cut and paste from reply to other post>

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