I agree it's annoying, but there are good solutions available...
1 -
In the user control you can use the @reference directive to make the type
available, something like:
<%@ Reference Page="~/about.aspx" %>
which should make the cast work...
problem with this is that it ties your user control to that particular
page - which defeats part of the purpose of using a user control...
2 -
Using an interface or a base class in the app_code is the right way to do it
(unless you go with #3). This is the ASP.NET team's attempt to force
developers to code better (which in theory I agree with). I'm not sure why
you are having problems with this...but I myself find it a little annoying
and generally prefer #3.
3 -
Using the Web Application Project which you can (freely) download from:
http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx
Once installed, you can create new web applications projects which behave A
LOT more like everything worked in 2003. I use this almost exclusively for
anything that's midly complicated (as far as structure goes). You'll have
to restart your project though..copy and pasting should mostly work :)
Karl
--
http://www.openmymind.net/ http://www.codebetter.com/
"Eric" <sp**@spam.nowrote in message
news:e4**************@TK2MSFTNGP04.phx.gbl...
>I got a particular problem in visual studio 2005
There's a user control on page and I want to meka a cast like this
MyPage mp=(MyPage)this.Page;
Error is : cannot cast from ASP.mypage_blalala_aspx to MyPage.
Stupid namespace ASP doesn't have that class name.
I can't even put any base classes to that crazy App_Code folder
to get the class reference. Am I doing something wrong?
All I want to do is during click to access a mainpage method from user
control
that is on a gridview. Or how to simply tell a parent page that one of
user controls raised some event. There can be many user controls on the
grid.
What's the point of blocking the page classes?
How to get rid of this terrible App_code folder and make things work?
I beg for help. Thanks.
Eric