how convert contents of string variable to label id

T

tony collier

Hi all

I have the following in my html page:

<asp:Label id="name1" runat="server"/>


and this code in my <script> section

string var="name1";
var.Text="whatever";


this won't work as is because it is seen as trying to execute the method
Text on string var. Is it possible to extract the value of var and apply
..Text method to what var contains rather than var object itself?
 
D

Dan Brussee

Hi all

I have the following in my html page:

<asp:Label id="name1" runat="server"/>


and this code in my <script> section

string var="name1";
var.Text="whatever";


this won't work as is because it is seen as trying to execute the method
Text on string var. Is it possible to extract the value of var and apply
.Text method to what var contains rather than var object itself?


Try this...

string var = name1.Text;

name1.Text = "whatever";
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top