how convert contents of string variable to label id

  • Thread starter Thread starter tony collier
  • Start date Start date
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?
 
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";
 
Back
Top