Page properties in the @Page directive

J

Jeff

Hi!

I was wondering if it is possible to access page properties in the
page's @Page directive. For example, if I had a property:


Public Property MyProperty ...


Can I set it using something like:


<%@ Page .... MyProperty="True" .... %>


I ask because I really dont want to handle every page's Load event just
to set this property.

Thanks!
 
M

Mark Rae

I was wondering if it is possible to access page properties in the
page's @Page directive. For example, if I had a property:

Public Property MyProperty ...

Can I set it using something like:

<%@ Page .... MyProperty="True" .... %>
No.

I ask because I really dont want to handle every page's Load event just
to set this property.

I'm not sure that there would be much difference between adding a few
letters to the @Page tag or adding a line of code to Page_Load, but never
mind...

Why not create a page template with the property you require and get all
your other pages to inherit from it...?
 
J

Jeff

Thanks for your response! Why dont I use a template page? I guess I
thought that was overkill for setting one property. That seems like it
will be the cleanest way to approach it without adding repetative code
for each page. You've sold me!

Thanks again!
 
M

Mark Rae

Thanks for your response! Why dont I use a template page? I guess I
thought that was overkill for setting one property. That seems like it
will be the cleanest way to approach it without adding repetative code
for each page. You've sold me!

Welcome to OOP...:)
 

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,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top