accessing a public variable

  • Thread starter Thread starter DC Gringo
  • Start date Start date
DC Gringo said:
How can I access a "public var1 as new string" from a .aspx page's user
control?

That's a bad idea. Variables should almost never be public - you lose any
control over what happens to it.

You should define a property in the user control, and the page should set
that property to var1.

BTW, you don't need to say "New String". Also, be sure to turn Options
Strict On.

John Saunders
 
You can access a public variable or property of your page object with the <%#
%> data binding syntax. You also need to call this.DataBind() on your page
object.
 
Back
Top