页面提交延迟造成客户端多次点击提交
对于这个有什么好的方法呢
我按照以前的方法在OnClientClick中写“this.disabled=true;this.form.submit();”
但不行,提交是提交了,那些事件都没有触发
该怎么搞啊
对于这个有什么好的方法呢
我按照以前的方法在OnClientClick中写“this.disabled=true;this.form.submit();”
但不行,提交是提交了,那些事件都没有触发
该怎么搞啊
解决方案 »
- 拼接页面元素的时候怎么出现代码了。求解
- 指定特定用户访问网站一般是怎么做到的?
- 在updatepanel中添加timer控件后Image,DropDownList,ListBox等控件不断闪烁
- 鼠标指到链接上,字体变粗,其它文字也抖动,如何好的办法解决》
- 保存后返回当前页面问题
- 将少量的业务信息放在Cookies行不行?
- 关于数据库权限问题~~急.....
- 【菜鸟提问】我想将隐藏的表格显示出来请问命令该怎么写呢?
- 登录 以后 如何让弹出的主页面为无菜单栏 和地址栏
- 将网站管理员的密码等放到Web.config文件中==不安全???
- 初学数据库连接——无法打开登录所请求的数据库
- 为什么我在编辑web.config文件时VS2005的只能感应功能不完整啊?
2.网上有SubmitOncePage类的源码编译成一个单独的dll,引用可以了
namespace myControl
{
/**//// <summary>
/// 名称:SubmitOncePage
/// 父类:System.Web.UI.Page
/// 描述:解决浏览器刷新造成的数据重复提交问题的page扩展类。
/// 示例: if (!this.IsRefreshed)
/// {
/// //具体代码
/// }
/// 原创:丛兴滋(cncxz) E-mail:[email protected]
/// </summary>
public class SubmitOncePage:System.Web.UI.Page
{
private string _strSessionKey;
private string _hiddenfieldName;
private string _strLastViewstate;
public SubmitOncePage()
{
_hiddenfieldName="__LastVIEWSTATE_SessionKey";
_strSessionKey=System.Guid.NewGuid().ToString();
_strLastViewstate=string.Empty; } public bool IsRefreshed
{
get
{
string str1 = this.Request.Form["__VIEWSTATE"];
_strLastViewstate = str1;
string str2 = this.Session[GetSessinKey()] as string;
bool flag1 = (str1 != null)&&(str2!=null)&&(str1==str2);
return flag1;
}
} protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
string str=GetSessinKey();
this.Session[str] = _strLastViewstate;
this.RegisterHiddenField(_hiddenfieldName,str);
base.Render (writer);
}
private string GetSessinKey()
{
string str = this.Request.Form[_hiddenfieldName];
return (str==null)?_strSessionKey:str;
}
}}
private void Button1_Click(object sender, System.EventArgs e)
{
int i=int.Parse(Label1.Text)+1;
Label1.Text = i.ToString();
if (!this.IsRefreshed)
{
WriteFile("a.txt", i.ToString());
}
WriteFile("b.txt", i.ToString());
} private void WriteFile(string strFileName,string strContent)
{
string str = this.Server.MapPath(strFileName);
System.IO.StreamWriter sw = System.IO.File.AppendText(str);
sw.WriteLine(strContent);
sw.Flush();
sw.Close();
}
to 2f 你的应该是解决提交后的刷新,我都是用redirect本页来解决的,谢谢
to 3f 我试试看,不知有没有更简单快捷的方式呢,最好是一个按钮解决啦,不然就很麻烦