I'm unable to output variable from code behind to aspx file. Please help me out, I'll be thankful. Here is code of aspx.cs and aspx files:
protected void Page_Load(object sender, EventArgs e)
{
String Marks = (String) (Session["Marks"]);
}
Here is code of aspx file:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1> <%=Marks%> </h1>
</div>
</form>
</body>
</html>
使用以下代码段
<h1><% =Session["Marks"]%></h1>
You can't access variables from the code behind. However you can access session in aspx page. So use Session["Marks"]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.