Substitution控件
<%@ OutputCache Duration="10" VaryByParam="none" %>
//設置緩存爲10秒
.aspx:
<form id="form1" runat="server">
<div>
<asp:Substitution ID="Substitution1" runat="server" MethodName="td" />
<br />
<br />
<asp:Label ID="Label1" runat="server"></asp:Label> </div>
</form>
.cs:
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}
public static string td(HttpContext context)
{
string aa = "當前時間:"+DateTime.Now.ToString();
return aa;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.