Setting Page properties from itself



Is there any easy way to set properties of a Page (or UserControl for
that matter) from *within itself*?
As an example, I have several .aspx pages which inherit from exactly
the same code-behind class, but I need to be able to pass different
properties to the class to make them to the correct thing.

The only way I've found to do this is to create the following - which
works fine, but doesn't feel right....
<script runat="server">
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
Me.MyProperty = True
End Sub

It would be a much nicer, simplier and easier solution to be able to
be able to set MyProperty = True somewhere... is this possible?

The option of hard-coding properties within the class for the "parent"
page is not going to work for my situation.

Many thanks in advance,
Tom :)


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