how to set property of web control to constant

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Ok, I have a custom web control (a server control) and I
want to set a property on this control equal to a
constant that exists in my code behind. Is there a nice
way to do this by putting code into my aspx file (it's
nice to see the properties all in one place). In ASP I
think you could do <%= somevalue %>...

Thanks!

Bob
 
Hi,

if you have that value in code-behind, you'd assign the value to the
control's property via code-behind member and if possible (control loaded)
before ViewState tracking starts (TrackViewState is called) in practise in
OnInit. This way setting the property won't cause value to be stored in
ViewState (if control property uses ViewState as underlying storage), but it
is considered as initial value (specified on every request).

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist


Ok, I have a custom web control (a server control) and I
want to set a property on this control equal to a
constant that exists in my code behind. Is there a nice
way to do this by putting code into my aspx file (it's
nice to see the properties all in one place). In ASP I
think you could do <%= somevalue %>...

Thanks!

Bob
 
Back
Top