|
你可以在不想被緩存的頁面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("^[一- 主站蜘蛛池模板: 久久亚洲AV成人无码国产漫画 | 99热视频这里只有久久精品 | 恋夜影院安卓免费列表uc | 天天色天天综合网 | 首页_亚洲AV色老汉影院 | 成年无码av片 | 日本免费一本天堂在线 | 学校捏奶揉下面污文h | 欧美精品做人一级爱免费 | a级老头和老太xxxx | 美女扒开腿让男人桶个爽 | 东北嫖妓对白粗口 | av老司机色爱区综合 | 高h 大尺度纯肉 np快穿 | 国产精品成人免费视频99 | 肉小说高h | 久久re视频这里精品青 | 免费国产网站 | 欲香欲色天天综合和网 | 国产精品久久久久久久伊一 | 欧美精品成人一区二区在线观看 | 一级大乳奶 | 精选国产AV精选一区二区三区 | 诱受H嗯啊巨肉各种play | 久久强奷乱码老熟女 | 欧美人妖12p | 奇虎成人网 | 日韩a在线看免费观看视频 日韩a视频在线观看 | 校园刺激全黄H全肉细节文 校园纯肉H教室第一次 | 日本久久道一区二区三区 | 手机在线亚洲日韩国产 | 手机看片国产免费久久网 | 久久高清免费视频 | 国模精品一区二区三区视频 | 成人无码在线超碰视频 | 狠狠久久免费视频在线 | 男人到天堂a线牛叉在线 | 国产视频a在线观看v | 国产女人视频免费观看 | 伦理片a在线线2 | 亚洲日本一区二区三区在线不卡 |