我有以下代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<body style="height: 1336px">
<input type="hidden" id="loadingtime"/>
.
.
.
.
</body>
</html>
Code.cs 文件是:
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Diagnostics;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string s = "";
HiddenField t = (HiddenField)Page.FindControl("loadingtime");
s = t.Value;
Response.Write("<script language='javascript'>alert('It took : " + s + "')</script>");
}
}
我收到错误任何想法?
编辑:当我检索加载时间的值时,上述问题已成功解决,该值为空字符串。任何人都可以解决这个问题吗?