Reputation: 819
i'm simply trying to display a variable from the back end of an eform into a textbox on the front end, here's what i have so far.
.aspx.cs
if (!Page.IsPostBack)
{
string username = Request.ServerVariables["AUTH_USER"];
}
and in .aspx im trying to output the variable like:
<asp:TextBox ID="username" runat="server" Width="44px" ReadOnly="true" Text='<%username %>'></asp:TextBox>
Upvotes: 0
Views: 193
Reputation: 174
make username a public/protected class member and change .aspx line to below-
<asp:TextBox ID="username1" runat="server" Width="44px" ReadOnly="true" Text='<%= username %>'></asp:TextBox>
you need to use <%= var name %> and change text box name because you cant have two same name variable in class....
Upvotes: 1
Reputation: 13212
username.Text = Request.ServerVariables["AUTH_USER"];
Should do it. But you really ought to Google this.
Upvotes: 1