无效的回发或回调参数。关于弹出模态窗口

时间:2011-12-22 00:56:12

标签: c# linq-to-sql asp.net-ajax postback modalpopupextender

我有一个网页上有一个网格。单击“编辑”时,将打开一个弹出模式窗口。在弹出模式窗口中,有一个网格,下面是一个下拉列表和一个保存按钮。单击“保存”时,所选值将插入位于模态窗口中的网格中。所有内容都是第一次正常工作..但是如果您已经关闭模态窗口并且碰巧再次执行该过程(单击编辑)在第一个网格>模态窗口显示>选择ddl>点击保存按钮上的项目)发生回发错误..我使用更新面板,我还在模态窗口内的添加按钮添加了一个回发触发器..

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. 

第一个网格的编辑按钮中的代码(这会调用模态窗口打开)

 protected void grd_depreciation_RowEditing(object sender, GridViewEditEventArgs e)
    {
        Guid DepID = new Guid(grd_depreciation.DataKeys[e.NewEditIndex].Values[0].ToString());

        //Show the Depreciation Modal Popup
        EditModalDepPopup.Show();
        //btnModalDepreciation_Click(sender,e);

        //checks the type of depreciation.. Network or Equipment
        DropDownList ddldescriptiondep = (DropDownList)(grd_depreciation.Rows[e.NewEditIndex].Cells[0].FindControl("ddlDescriptionDep"));
        var incotype = (ddldescriptiondep.SelectedItem).ToString();
        populategrd_Editdepreciation(DepID, incotype);

    }

继承模态窗口内的添加按钮中的代码(导致错误的那个)

 MarginAnalysi checkmarginanalysisid = MarginAnalysisAssumption_worker.get(a => a.ProjectCode == lbl_projectCode.Text).SingleOrDefault();
            DepreciationMatrix tblDepreciationMatrix = new DepreciationMatrix();

            tblDepreciationMatrix.DepMatrixID = Guid.NewGuid();
            tblDepreciationMatrix.DepID = new Guid(ViewState["DepID"].ToString());
            tblDepreciationMatrix.IncCapexOpexID = new Guid(ddDepreciationModalEmpty.SelectedValue);
            DepreciationMatrix_worker.insert(tblDepreciationMatrix);
            DepreciationMatrix_worker.submit();

 EditModalDepPopup.Show();

            populategrd_Editdepreciation(new Guid(ViewState["DepID"].ToString()), ViewState["incotype"].ToString());

在模态窗口上填充网格的代码

//Populate Edit Depreciaiton Grid on Modal
    public void populategrd_Editdepreciation(Guid DepID, string incotype)
    {
        ViewState["DepID"] = DepID;
        ViewState["incotype"] = incotype;
        var x = from a in DepreciationMatrix_worker.get(a => a.DepID == DepID)
                select new { a.DepMatrixID, a.IncCapexOpexID };

        grd_Editdepreciation.DataSource = x;
        grd_Editdepreciation.DataBind();

        //Populate dropdownlist on edit depreciation modal

        MarginAnalysi checkmarginanalysisid = MarginAnalysisAssumption_worker.get(a => a.ProjectCode == lbl_projectCode.Text).SingleOrDefault();

        //Selects eithers Equipment or Network Depreciation
        string test = incotype.ToUpper();

        if (test.Contains("EQUIPMENT"))
        {
            var dropdowndepreciationmodal = from a in tblIncCapexOpex_worker.get(a => a.MarginAnalysisID == checkmarginanalysisid.MarginAnalysisID && a.IncCoTypeID == "CAPEX" && a.DepreciationTypeID == "EQUIPMENT")
                                            select new { text = a.Description, value = a.IncCapexOpexID };

            populateDropdownlist(ddDepreciationModalEmpty, dropdowndepreciationmodal, true);
        }
        else
        {
            var dropdowndepreciationmodal = from a in tblIncCapexOpex_worker.get(a => a.MarginAnalysisID == checkmarginanalysisid.MarginAnalysisID && a.IncCoTypeID == "CAPEX" && a.DepreciationTypeID == "NETWORK")
                                            select new { text = a.Description, value = a.IncCapexOpexID };

            populateDropdownlist(ddDepreciationModalEmpty, dropdowndepreciationmodal, true);
        }



    }

0 个答案:

没有答案