簡體   English   中英

訪問aspx.cs文件中的變量並在文本框中顯示

[英]Access variable in aspx.cs file and display in text box

這是我的Emial.Aspx.cs文件。 我有一個名為loginEmail的公共變量。

public String loginEmail;

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

我想在波紋管文本框中顯示該變量。 但這對我不起作用。

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

錯誤:

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

請幫我。

在頁面加載事件中

TextBox_name.Text = loginEmail;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM