防刷新代码:
public partial class _default : System.Web.UI.Page
    {
        private bool _refreshState;
        private bool _isRefresh;        protected void Page_Load(object sender, EventArgs e)
        {
            Label1.Text = _isRefresh.ToString();
        }        protected void Button1_Click(object sender, EventArgs e)
        {
            if (_isRefresh)
                Response.Write("<script>alert('do'nt refresh')</script>");
            else
                Response.Write("<script>alert('click button1')</script>");
        }        protected override void LoadViewState(object savedState)
        {
            object[] AllStates = (object[])savedState;
            base.LoadViewState(AllStates[0]);            _refreshState = Convert.ToBoolean(AllStates[1]);
            _isRefresh = _refreshState == (Session["__ISREFRESH"] == null ? false : (bool)Session["__ISREFRESH"]);
        }        protected override object SaveViewState()
        {
            Session["__ISREFRESH"] = _refreshState;
            object[] AllStates = new object[2];
            AllStates[0] = base.SaveViewState();
            AllStates[1] = !_refreshState;
            return AllStates;
        }
    }

解决方案 »

  1.   

    在你网站下建个基类集成page,在基类中加上上面的代码,然后所有页面继承基类就可以每个页面都使用了
      

  2.   

    在处理完之后添加
    Response.Redirect(...)
    //到当前叶面PetShop是这样处理的或者用js控制重复提交
      

  3.   

    我也遇到过这个问题,总结了一下有两种方法:
     1:将数据保存之后,立即转到另一个页面,即:Response.Redirect(...),这个页面可以是显示操作成功的页面。使用此方法将不能显示弹出的如:操作成功 等确认框。
     2:数据保存后,加上:
      Response.Write("<script>alert(\"操作成功!\")</script>");
      Response.Write("<script>window.location.href=window.location.href;</script>");
    仅供楼主参考,造成不便本人不负任何责任。
    呵呵。
      

  4.   

    function _doPostBack(){};
    if(typeof("__doPostBack")=="function")
    {
    _doPostBack=__doPostBack;
    __doPostBack=_doPostBackNew;
    }document.attachEvent("onmousemove",_onmousemove);
    var _isPosting=false;
    var _divMask=null;function _onmousemove()
    {
    if(_divMask)
    with(_divMask.runtimeStyle)
    {
    left=event.clientX+document.body.scrollLeft-4;
    top=event.clientY+document.body.scrollTop-4;
    }
    }
    function _makeMask()
    {
    var div=document.createElement("DIV");
    with(div.runtimeStyle)
    {
    position="absolute";
    zIndex=999999;
    fontSize="1px";
    left=event.clientX+document.body.scrollLeft-4;
    top=event.clientY+document.body.scrollTop-4;
    width="8px";
    height="8px";
    cursor="wait";

    backgroundColor="gray";
    filter="alpha(opacity=10)";
    }
    try
    {
    document.body.insertAdjacentElement("BeforeEnd",div);
    div.onblur=new Function("this.focus()");
    div.focus();
    }
    catch(x){}

    if(_divMask)_divMask.removeNode(true);
    _divMask=div;
    }function _doPostBackNew(sender,args)
    {
    if(_isPosting)
    return event.returnValue=!(event.cancelBubble=true); status="正在更新页面...";
    _doPostBack(sender,args);
    _isPosting=true;
    _makeMask();
    }function _onformsubmit()
    {
    if (typeof(Page_ClientValidate) == 'function') 

    if(!Page_ClientValidate()) 

    return; 
    }  }
    if(_isPosting)
    return event.returnValue=!(event.cancelBubble=true); _isPosting=true;
    _makeMask();
    }new function _attachForms()
    {
    with(new Enumerator(document.forms))
    for(;!atEnd();moveNext())
    {
    item().attachEvent("onsubmit",_onformsubmit);
    var div=document.createElement("div");
    div.runtimeStyle.width="0px";
    div.runtimeStyle.hight="0px";
    div.runtimeStyle.overflow="hidden";
    div.runtimeStyle.position="absolute";
    item(0).insertAdjacentElement("afterbegin",div);
    div.innerHTML="<INPUT TYPE=Submit name='webformpatchsubmitelement' onclick='return event.returnValue=false' id='webformpatchsubmitelement' value='webformpatchsubmitelement'/>";
    }
    }
      

  5.   

    用AJAX作,在一个按钮里完成就可以了.
      

  6.   

    没有遇到过这种情况,ajax能搞定吧