易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.NET中防止页面多次提交的代码实现

此处提供的代码用来实现当asp.net页面中的某个Button被点击后disable掉该页面中所有的Button,从而防止提交延时导致的多次提交。基于之前的onceclickbutton脚本.
//ASP.NET中防止页面多次提交的代码:javascript< script language="javascript"> < !-- function disableOtherSubmit() {
var obj = event.srcElement;
var objs = document.getElementsByTagName('INPUT');
for(var i=0; i< objs.length; i++)
{
if(objs[i].type.toLowerCase() == 'submit')
{
objs[i].disabled = true;
}
}
} //--> < /script>//ASP.NET中防止页面多次提交的代码:asp.netpublic class PreventMultiClick : System.Web.UI.Page {
protected System.Web.UI.WebControls.Button Button1; protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.LinkButton LinkButton1; protected System.Web.UI.WebControls.Button Button3; private void Page_Load(object sender, System.EventArgs e)
{
this.GetPostBackEventReference(this.Button3);
//保证 __doPostBack(eventTarget, eventArgument) 正确注册 if(!IsPostBack)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("if (typeof(Page_ClientValidate) == 'function')
{
if (Page_ClientValidate() == false)
{
return false;
}
}"); //保证验证函数的执行 sb.Append("if(window.confirm('are you sure?')==false) return false; ");
//自定义客户端脚本 sb.Append("disableOtherSubmit(); ");
// disable所有submit按钮 sb.Append(this.GetPostBackEventReference(this.Button3));
//用__doPostBack来提交,保证按钮的服务器端click事件执行 sb.Append("; ");
Button3.Attributes.Add("onclick",sb.ToString());
}
} #region Web Form Designer generated code override protected void OnInit(EventArgs e)
{
// // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent();
base.OnInit(e);
}
/// < summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// < /summary> private void InitializeComponent()
{
this.Butto


相关文档:

MD5加密的一般方法(ASP.NET / C#2005)

  /// <summary>
/// 方法一:通过使用 new 运算符创建对象
/// </summary>
/// <param name="strSource">需要加密的明文</param>
/// <returns>返回16位加密结果,该结果取32位加密结果的第9位到25位</returns>
public string Get_MD5_Method1(strin ......

ASP.NET 2.0 正式版中无刷新页面的开发

示例代码下载4K
   在已经发布的 ASP.NET2.0 中,无刷新页面开发相关部分同 beta2 有不少改动。而且在越来越多的 Ajax 开发包被开发出来的情况下, ASP.NET2.0 自带的无刷新页面技术没有被很多人了解,甚至不少人认为该功能有些“鸡肋”。但如果我们仅仅是在程序中加入很少部分的 Ajax 特性, A ......

ASP.NET AppearanceEditorPart Web 服务器控件概述


      AppearanceEditorPart Web 服务器控件提供了一个编辑器控件,最终用户可以使用该控件在相关联的 WebPart 控件上编辑数个用户界面 (UI) 属性。
      AppearanceEditorPart 控件使最终用户能够编辑 WebPart 控件的几个用户界面属性。下表列出了用户可自定义的功 ......

ASP.NET CatalogZone Web 服务器控件概述

 
      Web 部件控件(例如 CatalogZone 控件)的一项主要功能是可以让最终用户个性化网页并保存其个性化设置。CatalogZone 控件允许最终用户在运行时向 Web 部件页添加 WebPart 控件或其他服务器控件。CatalogZone 控件用作 Web 部件控件集内的主控件,用于在网页中承载 CatalogPart 控件 ......

asp.net中使用javascript的方法及区别

1.使用 使用Response.Write,这种方法会把JS代码写在页面的最顶部(的前面):
2. 使用: page.ClientScript.RegisterStartupScript(); 这种方法会把JS代码嵌入在页面的底部、表单的最后 (前面),适用于要在页面控件加载完成后运行的JS代码
3.使用RegisterClientScriptBlock();这种方法会把JS代码嵌入在页面的顶部、 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号