accessing a public variable

  • Thread starter Thread starter DC Gringo
  • Start date Start date
D

DC Gringo

How can I access a "public var1 as new string" from a .aspx page's user
control?
 
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.
 

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

Back
Top