Referencing Page properties from child control

G

Guest

I'm declaring public properties in a Page's code behind file (not
declaratively). I would like to read and assign these from a child
control's cs file. The Page's inherits attribute is _Default. So, for
example, I would like to reach _Default.StudentID where StudentID is a
public property of _Default. Seems this should be doable but cannot figure
it out.

Thanks,

Peter
 
M

Matt

You need to cast the Page reference to the type of the code-behind
class ... So in the code-behind for the User Control do something like:

((_Default)this.Page).StudentID
 
G

Guest

Matt, Looked great but here's a line in my user control:

int status = ((_Default)this.Page).Status;

Doesn't compile. Asks "Are you missing Using statement or Assembly...?"

Suggestions?

Peter
 

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,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top