By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,854 Members | 869 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,854 IT Pros & Developers. It's quick & easy.

ASP.Net 2.0 - refering to the web page class

P: n/a
Just loaded up ASP.Net 2.0 and found that I can't refer to a specific web
page class from another class.

For example:

Partial Public Class _Default
Inherits System.Web.UI.Page

End Class

In another class defined in tha project, I get a Not Defined error

Public Class Class2

Private _def As _Default 'this line generates the error

End Class

I'd like to be able to do this so I can implement the MVC pattern.

Must be something simple as I could not imagine that this would be a
restriction.

Regards,

Nick

Feb 9 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
you shouldn't need this for the MVC pattern, but to reference another page,
you need reference directive in the calling page.

-- bruce (sqlwork.com)

"Nick Zdunic" <Ni********@discussions.microsoft.com> wrote in message
news:CA**********************************@microsof t.com...
Just loaded up ASP.Net 2.0 and found that I can't refer to a specific web
page class from another class.

For example:

Partial Public Class _Default
Inherits System.Web.UI.Page

End Class

In another class defined in tha project, I get a Not Defined error

Public Class Class2

Private _def As _Default 'this line generates the error

End Class

I'd like to be able to do this so I can implement the MVC pattern.

Must be something simple as I could not imagine that this would be a
restriction.

Regards,

Nick

Feb 10 '06 #2

P: n/a
The implementation of MVC I use, taken from profession Design Patterns in
VB.Net, does need it.

Class2 is not a page it is normal class that needs to have a reference to
webpage class _Default

"Bruce Barker" wrote:
you shouldn't need this for the MVC pattern, but to reference another page,
you need reference directive in the calling page.

-- bruce (sqlwork.com)

"Nick Zdunic" <Ni********@discussions.microsoft.com> wrote in message
news:CA**********************************@microsof t.com...
Just loaded up ASP.Net 2.0 and found that I can't refer to a specific web
page class from another class.

For example:

Partial Public Class _Default
Inherits System.Web.UI.Page

End Class

In another class defined in tha project, I get a Not Defined error

Public Class Class2

Private _def As _Default 'this line generates the error

End Class

I'd like to be able to do this so I can implement the MVC pattern.

Must be something simple as I could not imagine that this would be a
restriction.

Regards,

Nick


Feb 10 '06 #3

P: n/a
What we did was create a BasePage class in a sub-folder under App_Code
(you've probably realized that this is where you have to put the code
that's not part of a page).

For you it would look like this:
Public Class BasePage
Inherits System.Web.UI.Page

End Class

Then your _Default page would inherit from BasePage.
Include in BasePage all the functions you wanted to expose from
_Default.

Feb 10 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.