fragment.ascx
来自「Other things about csharp. you could lea」· ASCX 代码 · 共 44 行
ASCX
44 行
<%@ Language="C#" %>
<%@ OutputCache Duration="10" VaryByControl="Category"%>
<Script runat=server>
public void Button_Click(Object sender, EventArgs e){
if (Category.Value == ""){
Response.Cache.SetNoServerCaching();
CategoryItem.InnerHtml = "Not cached...";
}
else
CategoryItem.InnerHtml = "You selected: <font color=red>" + Category.Value + "</font>";
}
public void Page_Load(){
// Get the Date and Time, once again this should not change after the first run
DateTime NowTime = DateTime.Now;
DateTime Expires = NowTime.AddSeconds(10);
CreatedStamp.InnerHtml = NowTime.ToString("r");
ExpiresStamp.InnerHtml = Expires.ToString("r");
}
</Script>
<form method="post" runat=server>
Category: <select id="Category" size=1 runat=server>
<option value=""><!--Select Category--></option>
<option>psychology</option>
<option>business</option>
<option value="Popular Computer">popular_comp</option>
</select>
<input type=submit value="Lookup" OnServerClick="Button_Click" runat=server>
</form>
<Font size=6>
<B id=CategoryItem runat=server></B>
<P>
Fragment Cache created: <Font color=red><B id=CreatedStamp runat=server></B></Font>
<BR>
Fragment Cache expires: <Font color=red><B id=ExpiresStamp runat=server></B></Font>
</Font>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?