Update server side asp variable in page behind code

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.
 
K

Kevin Spencer

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.
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top