2011-12-22 3 views
1

그리드가있는 웹 페이지가 있습니다. 편집을 클릭하면 팝업 모달 창이 열립니다. 팝업 모달 창 안에는 표가 있고 그 아래에 드롭 다운 목록과 저장 버튼이 있습니다. 저장을 클릭하면 선택한 값이 모달 창에있는 눈금에 삽입됩니다.포스트 백에서 오류가 발생했습니다.

모든 것이 처음에는 잘 작동하지만, 이미 모달 창을 닫고 프로세스를 다시 수행하는 경우 (첫 번째 모눈에서 수정 클릭> 모달 창보기> 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); 

    } 
(이 열 모달 창을 호출) .. 업데이트 패널을 사용하고 또한 모달 창 내부의 추가 버튼에 postbacktrigger 추가 모달 창에서 격자를 채울 수

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()); 

코드 :

01,235

여기 모달 창 (오류를 발생시키는 것) 내부의 추가 버튼의 코드입니다

//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> 
+0

당신은 '또한 모달 창 안의 추가 버튼에 포스트 백 트리거를 추가했습니다'라고 말했습니까? 당신은'postbacktrigger'없이 그것을 시도 했습니까? [http://msdn.microsoft.com/en-us/library/ms223397.aspx](ClientScriptManager.RegisterForEventValidation 메서드 (String)) – Bastardo

+0

@OkayGuy 예 이미 확인했습니다. 같은 오류가 발생했습니다. – anonymous1110

답변

0

무엇이 잘못되었는지에 대한 아이디어를 얻으려면이 질문에 대한 내 대답을보십시오.

https://stackoverflow.com/a/8572928/168371

문제는 코드 만 업데이트 패널 내부 아니고, 마크 업 된 값이 일부 통제하지 않습니다.

추가적 도움을 얻 으면주십시오.

+0

안녕하세요, 모두 드롭 다운 목록 및 그리드는 이미 업데이트 패널 내에 있습니다 .. – anonymous1110

+0

또한 aspx 코드를 게시하십시오. –

+0

안녕, ive 이미 aspx 코드를 붙여 넣습니다. modalpopout이 작성된 코드 만 붙여 넣었음을 기억하십시오. 나는 aspx가 너무 커서 다른 것들을 붙일 수 없다. – anonymous1110

관련 문제