Saturday, March 24, 2012

passing variables from aspx page to ascx control

Is there a SOP for setting variables on an ASPX page that the usercontrols
on that page can read?

I'd like to set a 'template=' variable that various other controls can see
(the
header, navigation, footer, etc.).

Would simply setting a public variable be enough?

-DarrelYes, it is enough if you have public properties in the aspx page, you can
access those values using "Page" property of user control. Even you can
access all the controls in that page using this property.

--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com

"darrel" <notreal@.hotmail.com> wrote in message
news:uOW2qIrPEHA.3748@.TK2MSFTNGP09.phx.gbl...
> Is there a SOP for setting variables on an ASPX page that the usercontrols
> on that page can read?
> I'd like to set a 'template=' variable that various other controls can see
> (the
> header, navigation, footer, etc.).
> Would simply setting a public variable be enough?
> -Darrel
> Yes, it is enough if you have public properties in the aspx page, you can
> access those values using "Page" property of user control.

Thanks, Saravana!

-Darrel

0 comments:

Post a Comment