当前位置:编程学习 > C#/ASP.NET >>

问为什么c#程序里直接执行后没有结果,但设置断点再一步步执行以后就有结果了?

这是程序 除了红色的执行意外 其它的没有执行,但是设置断点可以执行
protected void btnNextAction_Click(object sender, EventArgs e)
        {

            Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('第一步');</script>", false);            System.Threading.Thread.Sleep(5000);  
            try
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('第1.5步');</script>", false);
                if (dd_WF_Actions.SelectedValue.IndexOf("跳过") == -1)
                {
                    if (!String.IsNullOrEmpty(Hi_MethodName.Value.Trim()))
                    {
                        //调用父页面的暂存按钮事件
                        //用反射方法动态调用父页面的方法
                        System.Web.UI.Page p = this.Page;
                        Type pageType = p.GetType();
                       
                        MethodInfo mi = pageType.GetMethod(Hi_MethodName.Value + "_Click");
                        mi.Invoke(p, new object[] { new Button(), new EventArgs() });
                    }
                }
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('第1.6步');</script>", false);
                InitSdi();

                List<string> TempList = dd_WF_Actions.SelectedItem.Value.Split(',').ToList();
                
                SubmitResult sr = new SubmitResult();
                string s = TempList[2];
                int i = dd_WF_Actions.SelectedIndex;
                //基本
                sr.instanceID = new Guid(TempList[0]);
                sr.stateInstanceID = new Guid(TempList[1]);
                sr.submitDepartment = inceptDepartment.Value.ToString();
                sr.submitDuty = inceptDuty.Value.ToString();
                sr.submitDescription = tb_WF_Remark.Text;
                sr.submitMode = "部门职能";
                sr.submitResult = s;
                sr.submitTime = System.DateTime.Now;
                sr.submitUser = sdi.Name;
                sr.triggerType = sdi.FullName;

                var v = my.wf.businessSubmit(my.wfpid, sr);
                SIPMS.BusiManage.DAL.Jurisdiction.Jurisdiction dal = new SIPMS.BusiManage.DAL.Jurisdiction.Jurisdiction();
                //string stateId = dal.GetItem(TempList[0]);
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('第二步');</script>", false);
                if (dal.UpdateJurisdiction(TempList[0])>0)
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('第3步');</script>", false);
                   // dal.UpdateItem(TempList[0], stateId, dal.GetTransactUser(TempList[0]));
                }
               --------------------编程问答-------------------- 你直接把UI线程休眠了5秒,页面就假死了 --------------------编程问答--------------------   System.Threading.Thread.Sleep(5000);  
这是我后来加上去的。 --------------------编程问答-------------------- webform程序后台代码调用前台js的alert,是无状态的,跟winform的MessageBox不一样

后面的代码不会等你点击“确定”后再执行
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,