控制我有以下代碼:ASP.NET是指從.aspx文件
<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>");
}
}
我得到錯誤 任何想法?
編輯: 以上問題已成功解決 現在,當我檢索加載時間的值,值爲空字符串。任何人都可以解決這個問題嗎?
錯誤???????? – 2012-04-08 10:29:01
NullReference ... – Kameron 2012-04-08 11:12:51