遇到如下的问题,
切换view的时候,老是提示“请先关闭当前表单”,
代码如下
//判断当前view是否有打开
if (currentRecId != recId)
{
//获取已打开的view
IDynamicFormView view = this.View.GetView(this.View.PageId + "_" + currentRecId);
if (view != null)
{
//关闭已打开view
view.Close();
this.View.SendDynamicFormAction(view);
}
//打开新的view
BillShowParameter showParam = new BillShowParameter();
showParam.FormId = formId;
showParam.OpenStyle.ShowType = Kingdee.BOS.Core.DynamicForm.ShowType.InContainer;
showParam.OpenStyle.TagetKey = "FShowFormPanel";
showParam.PageId = this.View.PageId + "_" + strId;
//showParam.Caption = strPlanDate;
showParam.Status = showStatus;
//showParam.Height = 450;
//showParam.Width = 720;
//showParam.CustomComplexParams.Add("FUPATIENT", CurrentFuPatientInfo);
showParam.CustomComplexParams.Add("FUREC", rec);
if (showStatus != OperationStatus.ADDNEW)
showParam.PKey = strPKey;
//记住当前view
currentRecId = recId;
this.View.ShowForm(showParam);
}
代码中如何才能彻底关闭到过往打开的view呢?
这里有几个变量不清楚你是怎么用的?
recId
strId
currentRecId
还有就是PageId,每次都创建一个新的
建议如下
if(!curretrecid.isnullorempty())
{
idynamicformvie view = this.view.getview(currentrecid);
if(view==null)
{
return;
}
view.close();
this.view.senddynamicformaction(view);
}
// 打开新的view
......
showparam.pageid=currentrecid=guid.newguid.tostring();
// currentrecid=recid;注释
this.view.showform(showparam);
推荐阅读
您的鼓励与嘉奖将成为创作者们前进的动力,如果觉得本文还不错,可以给予作者创作打赏哦!
请选择打赏金币数 *