|
你可以在不想被緩存的頁面Page_Load事件中加上如下代碼
復制代碼 代碼如下:
Response.Expires = 0;
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
Response.AddHeader("pragma", "no-cache");
Response.CacheControl = "no-cache";
編譯成DLL:
“開始”―“運行”―“cmd” ,用下面的兩條命令編譯AuthCode.cs文件為.DLL文件。(AuthCode.cs文件保存在“C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727”目錄下)命令如下:
cd C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727
csc /target:library AuthCode.cs
GridView導出到Excel代碼2:
復制代碼 代碼如下:
public override void VerifyRenderingInServerForm(Control control)
{
//(必須有)
//base.VerifyRenderingInServerForm(control);
}
public void Generate(string Typename, string scswId, GridView TempGrid)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Charset = "utf-8";
string Filename = Typename + scswId + ".xls";
HttpContext.Current.Response.AppendHeader("Content-Disposition", "online;filename=" + Filename);
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
HttpContext.Current.Response.ContentType = "application/ms-excel";
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
TempGrid.RenderControl(oHtmlTextWriter);
HttpContext.Current.Response.Write(oStringWriter.ToString());
HttpContext.Current.Response.End();
}
提示并跳轉:
復制代碼 代碼如下:
ScriptManager.RegisterStartupScript(this.Page, GetType(),
"askAndRederect", "alert('請先登錄!');window.location.href='Index.ASPx';", true);
GridView中刪除某一行前詢問:
復制代碼 代碼如下:
((LinkButton)e.Row.Cells[4].Controls[2]).Attributes.Add("onclick", "Javascript:return confirm('您確認要刪除嗎?')");
GridView隔行變色代碼:
復制代碼 代碼如下:
protected void GVLinkman_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00A9FF'");
//當鼠標移開時還原背景色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
}
}
ASP.NET 正則表達式:
復制代碼 代碼如下:
//驗證手機號
Regex r = new Regex(@"^(13|15|18)/d{9}$");
return r.IsMatch(mobilePhone);
//帶86或者+86的手機號
Regex regexMobile = new Regex(@"^((/+86)|(86))?(13|15|18)/d{9}$");
//驗證是否為中文
Regex regex = new Regex("^[一- 主站蜘蛛池模板: 国产精品福利午夜一级毛片 | 97菊爱网 | 国产精品人人爱一区二区白浆 | 91精品国产综合久久消防器材 | 天天色综合5 | 在线观看91精品国产剧情免费 | 亚洲一区二区三区高清视频 | 精品一区二区三区免费站 | 91精彩视频在线观看 | 国产视频国产 | 在线免费观看色视频 | 欧美中文字幕一区二区三区 | 色综合天 | gogo全球高清人体成人 | 国产三级级在线观看大学生 | 久久91精品久久91综合 | 国产精品福利在线观看入口 | 午夜91| 久久伊人精品青青草原2021 | 国产精品久久久久久久久久一区 | 男女视频在线观看免费高清观看 | 美女扒开内衣看个够网站 | 肉色丝袜一区二区高跟鞋 | 亚洲国产成人综合精品2020 | 久久夜色精品国产亚洲 | 色影视| 韩国一级毛片视频免费观看 | 色老板在线看 | 91福利视频一区 | 日韩成人av在线 | 色哟哟网 | 国产成人香蕉在线视频网站 | 欧美精品v日韩精品v国产精品 | 亚洲综合网国产福利精品一区 | 成人免费看黄网站yyy456 | 韩国免费毛片在线看 | 伊人色网站| 欧美日韩视频在线第一区二区三区 | 中文字幕va一区二区三区 | 国产麻豆91在线 | 91国内揄拍国内精品对白 |