public partial class WebForm1 : System.Web.UI.Page
{
string timedate = DateTime.Now.ToString("MM/dd/yyyy HH:mm:tt");
protected void Page_Load(object sender, EventArgs e)
{
}
答案 0 :(得分:1)
如果我理解正确并且你需要在2页(webforms)之间共享数据,你可以使用Session:
e.g。在一页上:
string timedate = DateTime.Now.ToString("MM/dd/yyyy HH:mm:tt");
Session["timedate"] = timedate;
在另一页上:
string timedate;
if (Session["timedate"] != null) {
timedate = Session["timedate"].ToString();
}