Refering to web page class from another class

G

Guest

In 1.1 it was possible to refer to a web page class from another class

I've just started in v2.0 and found that this code sn't working

The web page class:

Partial Class _Default

Inherits System.Web.UI.Page

End Class

The class that want to refer to this:

Public Class Class1

Private _def As _Default

End Class

The _def variable wont compile as _Default is not defined.

Is there a directive I'm missing?
 
K

Karl Seguin [MVP]

This is made more difficult in 2.0 :(

The only way I know around it at this point is to place an interface for
your default class in app_code and reference the interface rather then the
class.

public interface IDefault
public property Name as string
end interface

partial class _Default
inherits Page
Implements IDefault

public property name as string
get ..
set..
end property
end class

public Class Class1
private _def as IDefault
....
end class.

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

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top