<% string **testString** = "Hello"; %>
<asp:label runat="server" ID="test123" *Text*="<% =**testString** %> "/>
how can i add a variable to the Text part in the label
?
<% string **testString** = "Hello"; %>
<asp:label runat="server" ID="test123" *Text*="<% =**testString** %> "/>
how can i add a variable to the Text part in the label
?
Initialize your variable like this
protected string abc;
and then assign value in page_load
abc= "test";
DataBind();
your aspx:
<asp:Label ID="myLabel" runat="server" Text='<%# abc%>' />
You can do something like:
<asp:Label runat="server" Text='<%= YourVariable %>' ID="test123" />
This is a bit of a duplicate. See this thread.