下面是我整个按钮的代码:private void Button1_Click(object sender, System.EventArgs e)
{     

if(this.Action=="new") // 如果是新文件首先要保存,即用户直接提交
{
  
}
else
{
//首先要保存一下,防止用户做了修改
Response.Write("<script language=javascript>window.opener.document.forms[0].Save.click();</script>");
           
}
   
DataTable TypeTable=this.CreateTable("Select StepType from Workflow_Stepdef where AppID="+this.AppID+" and StepID="+this.StartStepID);
if(TypeTable.Rows[0]["StepType"].ToString().Trim()=="2")//前一步为归档,要做归档处理
{
               this.Archive(); }
           DataTable StepTypeTable=this.CreateTable("Select StepType from Workflow_Stepdef where AppID="+this.AppID+" and StepID="+this.GetEndStepID(FlowTo));
  if(StepTypeTable.Rows[0]["StepType"].ToString().Trim()=="3")//如果选择的步骤的类型是结束的话,就结束,不需要重新操作数据库
{  //结束本流程
this.Over();
this.CloseSelf();
Response.Write("<script language=javascript>window.opener.document.forms[0].Redirect.click();</script>");
   
}
else 
{
this.Redirect();
}  //数据在这里的时候还是正确

}//在这里跳出的时候就出现错误了,数据被修改。。

解决方案 »

  1.   

    jsljy(小卢):
               按钮会刷新页面,是不是在刷新时执行的呀       你好:
                  我上面的代码中:
                        Response.Write("<script language=javascript>window.opener.document.forms[0].Save.click();</script>");
            这个代码可能改变数据。是不是这里引起的?
      

  2.   

    为什么偶看到的你的代码连括号都不对应?难道是偶rpwt?
      

  3.   

    奇怪:  我把:
             Response.Write("<script language=javascript>window.opener.document.forms[0].Save.click();</script>");
    屏蔽掉之后,数据就对了,为什么程序执行完了。还要执行这句呢???
      

  4.   

    Response.Write("<script language=javascript>window.opener.document.forms[0].Save.click();</script>");这个是写到客户端的,后于服务段代码执行
    当然是跳出后才执行