Prev: What happened to the App_Code folder in Visual Studio 2010?
Next: Determining SQL Server 2008 Instance Name?
From: Tom on 27 Sep 2010 13:10
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....
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
Me.MyProperty = True
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,