how to call a variable in code behind to aspx page
The field must be declared public
for proper visibility from the ASPX markup. In any case, you could declare a property:
private string clients;
public string Clients { get { return clients; } }
UPDATE: It can also be declared as protected
, as stated in the comments below.
Then, to call it on the ASPX side:
<%=Clients%>
Note that this won’t work if you place it on a server tag attribute. For example:
<asp:Label runat=”server” Text=”<%=Clients%>” />
This isn’t valid. This is:
<div><%=Clients%></div>