Set Custom Page properties declaratively

G

Guest

Hi,

I have a base class (which inherits from System.Web.UI.Page) for all the
pages in my application. I have a property defined on this class that I want
to set declaratively in the .aspx (i.e., not in the .aspx.cs) file.

Is there any way to do this declaratively? When I try to use the <@ Page
....> directive, it only allows the predefined attributes to be used.

Thanks,

Richard Brown
 
K

Kevin Spencer

<script language="CSharp" runat="server">
// put your code in here
</script>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a horse to water,
but you can't make him think.
 
G

Guest

Thanks for replying so quickly. Unfortunately the example you have provided
does not meet my requirements on two counts:

1. This is not declarative. This is code, and I would add this to the
code-behind class.

2. The <script> tags allow the client to define functions, but not run code.

If the code requires to be run it needs the old-style <% %> breakout.
However this code is then run during the rendering of the page, which is
invoked from the .Net Framework (i.e,. the client does not have control over
when this code is executed).

I was wondering if there is a way of declaratively setting the properties of
the page class before the OnInit (in much the same way that properties are
set in a server control).

Thanks,

Richard Brown
 

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,050
Latest member
AngelS122

Latest Threads

Top