Where do I put the .cs file for this user control?

A

Alan Silver

Hello,

I have a user control that can show info in a number of different ways.
I do this by having several .ascx files, all of which refer to the same
..cs file.

I can't work out where to put this .cs file so that it will work. The
..ascx files are in the root of the web site, and if I put the .cs file
in there, then the compiler gives me the error "Unable to cast object of
type 'ASP.ShowCategory' to type 'ShowCategory" which I assume means it
can't find the class. If I put the .cs file in the App_Code folder, then
it tells me that is not allowed.

In case it helps, the top of one of the .ascx files looks like...

<%@ Language="C#" Inherits="ShowCategory" ClassName="ShowCategory"
CodeFile="ShowCategory.cs" %>

and the top of the .cs file (ignoring "using" statements) looks like...

public partial class ShowCategory : UserControl {

Any ideas? I'm really stuck here. TIA
 
J

jhcorey

Assuming that this would have worked in VS2003, there is a MS kit
available (I'm pretty sure) that let's you create projects in VS2005
just like you would in VS2003. Perhaps it will be part of a service
pack. But it all just makes me sooo confused.
I'll leave it to you to google for it. Or look on msdn.
 

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

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top