create a web form or user control but can't see it in code - ASP.net 2.0

  • Thread starter Vahid Dadashzadeh
  • Start date
V

Vahid Dadashzadeh

hi,
i've created a new web form or user control in asp.net 2.0, but i try
to see it in my codes and when i try to convert an object to the web
form, i can't see it like there is no webform with that name. for
example this code below :

_Default parentPage = (_Default)this.Page;

in the code above, i assume that i have user control and i want to get
reference to Page object from this usercontrol and my web form class
name is _Default, but compiler can't find class by the name of
_Default.
this problem is in asp.net 2.0.
can someone tell me what to do ?
 
K

Karl Seguin [MVP]

This is because of the new compilation model in 2.0. There's a 2003 project
model for 2005 available at:
http://webproject.scottgu.com/

Otherwise, you can add a @Reference directive atop your page to get access
to the type. Something like
<%@ Reference Page="~/whatever.aspx" %> and then you'll have access to the
class of the whatever.aspx page.

Finally, you can create a base class in the App_Code folder, and reference
that.

Karl
 

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,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top