Update server side asp variable in page behind code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a User Control. Is it possible to define a variable in the User Control HTML like this

<
Dim strTem
%

and then use the page behind code in the Page_Load event to update this strTemp variable? VBScript please.
 
Hi Robert,

I think you need to get more OOP under your belt. You're thinking
procedurally. A User Control is a class. When you use the Dim statement in a
class, you are essentially creating a Private field, which is not accessible
to anything other than the class itself. You need to expose data in your
User Control either through a Public Field (Public strTemp As String) or a
Public Property (Public Property strTemp As String). You can then access the
value through any other class, including the Page class.

And do yourself a favor, and turn Option Strict ON!

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

Robert said:
I have a User Control. Is it possible to define a variable in the User Control HTML like this:

<%
Dim strTemp
%>

and then use the page behind code in the Page_Load event to update this
strTemp variable? VBScript please.
 
Back
Top