Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 回发错误_C#_Asp.net_Linq_Eventvalidation - Fatal编程技术网

C# 回发错误

C# 回发错误,c#,asp.net,linq,eventvalidation,C#,Asp.net,Linq,Eventvalidation,我有一个网页上有一个网格。单击“编辑”时,将打开一个弹出模式窗口。在弹出模式窗口中,有一个网格,下面有一个dropdownlist和save按钮。单击“保存”时,选定值将插入模式窗口中的网格中 第一次一切正常,但是,如果您已经关闭模式窗口,并且碰巧再次执行该过程(单击第一个网格上的编辑>模式窗口显示>在ddl上选择项目>点击保存按钮),则会发生回发错误。我使用了一个更新面板,我还向模式窗口内的add按钮添加了一个postbacktrigger Invalid postback or callba

我有一个网页上有一个网格。单击“编辑”时,将打开一个弹出模式窗口。在弹出模式窗口中,有一个网格,下面有一个dropdownlist和save按钮。单击“保存”时,选定值将插入模式窗口中的网格中

第一次一切正常,但是,如果您已经关闭模式窗口,并且碰巧再次执行该过程(单击第一个网格上的编辑>模式窗口显示>在ddl上选择项目>点击保存按钮),则会发生回发错误。我使用了一个更新面板,我还向模式窗口内的add按钮添加了一个postbacktrigger

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. 
以下是模态窗口(导致错误的窗口)内的add按钮中的代码:

用于在模式窗口上填充网格的代码:

//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);
        }



    }
模式弹出框的Aspx代码。此代码位于updatepanel标记内

   <asp:Button ID="btnModalDepreciation" CssClass="popup_ButtonsHide" runat="server"
                                                                Text="Click here to show the modal" /><cc1:ModalPopupExtender BehaviorID="test4"
                                                                    ID="EditModalDepPopup" BackgroundCssClass="ModalPopupBG" runat="server" TargetControlID="btnModalDepreciation"
                                                                    PopupControlID="DivEditDepTab" Drag="True" PopupDragHandleControlID="DepPopupHeader"
                                                                    DynamicServicePath="" Enabled="True">
                                                                </cc1:ModalPopupExtender>
                                                            <div id="DivEditDepTab" style="display: none;" class="popupConfirmation2">
                                                                <div class="popup_Container">
                                                                    <div class="popup_Titlebar" id="DepPopupHeader">
                                                                        <div class="TitlebarLeft">
                                                                            Depreciation Items</div>
                                                                        <div class="TitlebarRight">
                                                                        </div>
                                                                    </div>
                                                                    <div class="popup_Body">
                                                                        Depreciation Details
                                                                        <br />
                                                                        <asp:Table ID="Table25" runat="server" Width="400px">
                                                                            <asp:TableRow>
                                                                                <asp:TableCell>
                                                                                    <asp:GridView ID="grd_Editdepreciation" runat="server" AutoGenerateColumns="False"
                                                                                        Width="100%" OnRowCancelingEdit="grd_Editdepreciation_RowCancelingEdit" OnRowDeleting="grd_Editdepreciation_RowDeleting"
                                                                                        OnRowEditing="grd_Editdepreciation_RowEditing" OnRowUpdating="grd_Editdepreciation_RowUpdating"
                                                                                        OnRowDataBound="grd_Editdepreciation_RowDataBound" DataKeyNames="DepMatrixID">
                                                                                        <Columns>
                                                                                            <asp:TemplateField HeaderText="Depreciation" SortExpression="Depreciation">
                                                                                                <EditItemTemplate>
                                                                                                    <asp:DropDownList ID="ddDepreciationModal" runat="server" Width="100%">
                                                                                                    </asp:DropDownList>
                                                                                                    <asp:HiddenField ID="hiddenIncCapexOpexID" runat="server" Value='<%# Bind("IncCapexOpexID") %>' />
                                                                                                </EditItemTemplate>
                                                                                                <ItemTemplate>
                                                                                                    <asp:DropDownList ID="ddDepreciationModal" runat="server" Enabled="False" Width="100%">
                                                                                                    </asp:DropDownList>
                                                                                                    <asp:HiddenField ID="hiddenIncCapexOpexID" runat="server" Value='<%# Bind("IncCapexOpexID") %>' />
                                                                                                </ItemTemplate>
                                                                                            </asp:TemplateField>
                                                                                            <asp:TemplateField ShowHeader="False">
                                                                                                <EditItemTemplate>
                                                                                                    <asp:LinkButton ID="btnUpdateDepModal" runat="server" CausesValidation="True" CommandName="Update"
                                                                                                        Text="Update"></asp:LinkButton>&nbsp;<asp:LinkButton ID="LinkButton2" runat="server"
                                                                                                            CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton></EditItemTemplate>
                                                                                                <ItemTemplate>
                                                                                                    <asp:LinkButton ID="btnEditDepModal" runat="server" CausesValidation="False" CommandName="Edit"
                                                                                                        Text="Edit"></asp:LinkButton>&nbsp;<asp:LinkButton ID="btnDeleteDepModal" runat="server"
                                                                                                            CausesValidation="False" CommandName="Delete" Text="Delete"></asp:LinkButton>
                                                                                                   <%-- <cc1:ConfirmButtonExtender ID="confirm1" TargetControlID ="btnDeleteDepModal" ConfirmText="Are you sure you want to delete this?" runat="server">
                                                                                                    </cc1:ConfirmButtonExtender>--%>
                                                                                                            </ItemTemplate>
                                                                                            </asp:TemplateField>
                                                                                        </Columns>
                                                                                        <EmptyDataTemplate>
                                                                                            No Data Found</EmptyDataTemplate>
                                                                                    </asp:GridView>
                                                                                </asp:TableCell></asp:TableRow>
                                                                        </asp:Table>
                                                                        <asp:Table ID="Table26" runat="server" Width="400px">
                                                                            <asp:TableRow>
                                                                                <asp:TableHeaderCell>Depreciation</asp:TableHeaderCell></asp:TableRow>
                                                                            <asp:TableRow>
                                                                                <asp:TableCell Width="70%">
                                                                                    <asp:DropDownList ID="ddDepreciationModalEmpty" runat="server" Width="100%">
                                                                                    </asp:DropDownList>
                                                                                </asp:TableCell><asp:TableCell Width="30%">
                                                                                    <asp:Button ID="btnAddDepreciationItem" runat="server" Text="Add" Height="26px" OnClick="btnAddDepreciationItem_Click"
                                                                                        Width="70%" /></asp:TableCell></asp:TableRow>
                                                                        </asp:Table>
                                                                        <asp:ValidationSummary ID="ValidationSummary22" runat="server" ValidationGroup="AddDepreciationModal" />
                                                                        <asp:ValidationSummary ID="ValidationSummary23" runat="server" ValidationGroup="DeleteDepreciationModal" />
                                                                    </div>
                                                                    <div class="popup_Buttons">
                                                                        <asp:Button ID="btnCancelDepreciationModal" runat="server" Text="Close" OnClick="CancelDepreciationItem_Click" /></div>
                                                                </div>
                                                            </div>

折旧项目
折旧明细

没有找到任何数据 折旧
//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);
        }



    }
   <asp:Button ID="btnModalDepreciation" CssClass="popup_ButtonsHide" runat="server"
                                                                Text="Click here to show the modal" /><cc1:ModalPopupExtender BehaviorID="test4"
                                                                    ID="EditModalDepPopup" BackgroundCssClass="ModalPopupBG" runat="server" TargetControlID="btnModalDepreciation"
                                                                    PopupControlID="DivEditDepTab" Drag="True" PopupDragHandleControlID="DepPopupHeader"
                                                                    DynamicServicePath="" Enabled="True">
                                                                </cc1:ModalPopupExtender>
                                                            <div id="DivEditDepTab" style="display: none;" class="popupConfirmation2">
                                                                <div class="popup_Container">
                                                                    <div class="popup_Titlebar" id="DepPopupHeader">
                                                                        <div class="TitlebarLeft">
                                                                            Depreciation Items</div>
                                                                        <div class="TitlebarRight">
                                                                        </div>
                                                                    </div>
                                                                    <div class="popup_Body">
                                                                        Depreciation Details
                                                                        <br />
                                                                        <asp:Table ID="Table25" runat="server" Width="400px">
                                                                            <asp:TableRow>
                                                                                <asp:TableCell>
                                                                                    <asp:GridView ID="grd_Editdepreciation" runat="server" AutoGenerateColumns="False"
                                                                                        Width="100%" OnRowCancelingEdit="grd_Editdepreciation_RowCancelingEdit" OnRowDeleting="grd_Editdepreciation_RowDeleting"
                                                                                        OnRowEditing="grd_Editdepreciation_RowEditing" OnRowUpdating="grd_Editdepreciation_RowUpdating"
                                                                                        OnRowDataBound="grd_Editdepreciation_RowDataBound" DataKeyNames="DepMatrixID">
                                                                                        <Columns>
                                                                                            <asp:TemplateField HeaderText="Depreciation" SortExpression="Depreciation">
                                                                                                <EditItemTemplate>
                                                                                                    <asp:DropDownList ID="ddDepreciationModal" runat="server" Width="100%">
                                                                                                    </asp:DropDownList>
                                                                                                    <asp:HiddenField ID="hiddenIncCapexOpexID" runat="server" Value='<%# Bind("IncCapexOpexID") %>' />
                                                                                                </EditItemTemplate>
                                                                                                <ItemTemplate>
                                                                                                    <asp:DropDownList ID="ddDepreciationModal" runat="server" Enabled="False" Width="100%">
                                                                                                    </asp:DropDownList>
                                                                                                    <asp:HiddenField ID="hiddenIncCapexOpexID" runat="server" Value='<%# Bind("IncCapexOpexID") %>' />
                                                                                                </ItemTemplate>
                                                                                            </asp:TemplateField>
                                                                                            <asp:TemplateField ShowHeader="False">
                                                                                                <EditItemTemplate>
                                                                                                    <asp:LinkButton ID="btnUpdateDepModal" runat="server" CausesValidation="True" CommandName="Update"
                                                                                                        Text="Update"></asp:LinkButton>&nbsp;<asp:LinkButton ID="LinkButton2" runat="server"
                                                                                                            CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton></EditItemTemplate>
                                                                                                <ItemTemplate>
                                                                                                    <asp:LinkButton ID="btnEditDepModal" runat="server" CausesValidation="False" CommandName="Edit"
                                                                                                        Text="Edit"></asp:LinkButton>&nbsp;<asp:LinkButton ID="btnDeleteDepModal" runat="server"
                                                                                                            CausesValidation="False" CommandName="Delete" Text="Delete"></asp:LinkButton>
                                                                                                   <%-- <cc1:ConfirmButtonExtender ID="confirm1" TargetControlID ="btnDeleteDepModal" ConfirmText="Are you sure you want to delete this?" runat="server">
                                                                                                    </cc1:ConfirmButtonExtender>--%>
                                                                                                            </ItemTemplate>
                                                                                            </asp:TemplateField>
                                                                                        </Columns>
                                                                                        <EmptyDataTemplate>
                                                                                            No Data Found</EmptyDataTemplate>
                                                                                    </asp:GridView>
                                                                                </asp:TableCell></asp:TableRow>
                                                                        </asp:Table>
                                                                        <asp:Table ID="Table26" runat="server" Width="400px">
                                                                            <asp:TableRow>
                                                                                <asp:TableHeaderCell>Depreciation</asp:TableHeaderCell></asp:TableRow>
                                                                            <asp:TableRow>
                                                                                <asp:TableCell Width="70%">
                                                                                    <asp:DropDownList ID="ddDepreciationModalEmpty" runat="server" Width="100%">
                                                                                    </asp:DropDownList>
                                                                                </asp:TableCell><asp:TableCell Width="30%">
                                                                                    <asp:Button ID="btnAddDepreciationItem" runat="server" Text="Add" Height="26px" OnClick="btnAddDepreciationItem_Click"
                                                                                        Width="70%" /></asp:TableCell></asp:TableRow>
                                                                        </asp:Table>
                                                                        <asp:ValidationSummary ID="ValidationSummary22" runat="server" ValidationGroup="AddDepreciationModal" />
                                                                        <asp:ValidationSummary ID="ValidationSummary23" runat="server" ValidationGroup="DeleteDepreciationModal" />
                                                                    </div>
                                                                    <div class="popup_Buttons">
                                                                        <asp:Button ID="btnCancelDepreciationModal" runat="server" Text="Close" OnClick="CancelDepreciationItem_Click" /></div>
                                                                </div>
                                                            </div>