四虎精品视频-四虎精品成人免费网站-四虎黄色网-四虎国产视频-国产免费91-国产蜜臀97一区二区三区

asp.net 開發的一些常用技巧

不使用頁面緩存:
你可以在不想被緩存的頁面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("^[一- 主站蜘蛛池模板: 王春宇| 洞房视频| 男男性恋免费视频网站| 欧美17p| 抖音在线官网| 原野电影| 果戈里起点女的被劫走是多少分钟| be helpful at home| 少爷和我短剧| 无锡地图高清版大图| h罩杯美女| 浙江卫视网络直播源| 四角号码| 最新好看电影| 一路向东电影| 正在直播乒乓赛事| 梁祝《引子》简谱| 曹查理林雅诗电影全集| 何丽萍| 河南卫视直播| 草原大作战| 白鹅课文| 去2| 以下关于宏病毒说法正确的是| 金珠电影| 卢靖姗老公是谁| 王牌御史| 裸舞在线观看| amari| 老男人电影完整版高清在线观看| 可爱美女跳舞蹈视频| 香港之夜在线观看免费观看| 山东教育电视台直播在线观看| 青楼春凳打板子作文| 肱骨骨折能评几级伤残| 快乐到底| 《鱼我所欲也》原文及译文| 金马电影网| 金花瓶梅花2的剧情简介| 拆迁补偿合同| 抖音 网页版|