0

Here is my Emial.Aspx.cs file. I have a public variable called loginEmail.

public String loginEmail;

protected void Page_Load(object sender, EventArgs e){
loginEmail= Session["Email"].ToString();
}

I want to display that variable in bellow textbox. But this is not worked for me.

<td>
   <asp:TextBox ID="TextBox_name" runat="server" Text = "<%= loginEmail %>";></asp:TextBox>
</td>

Error:

Parser Error Message: Server tags cannot contain <% ... %> constructs.

Please help me.

1 Answer 1

4

In the page Load event

TextBox_name.Text = loginEmail;
Sign up to request clarification or add additional context in comments.

3 Comments

Also change Text = "<%= loginEmail >"; to Text = "<%= loginEmail %>"
gr8. But cant we do this using tags?? Without go to code behind ?
yes but not as a server control - so - <input type="text" id="tbn" value=<%= loginEmail %>/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.