2013-05-09 58 views
0

因此,我在ASP.NET WebForm應用程序中有一個jQuery對話框,可以將所有包含的控件的內容發佈到另一個頁面。問題是FileUpload控件。當EnablEventValidation設置爲true,我想這是在默認情況下,我得到這個錯誤...當EnableEventValidation設置爲'false'時,未設置Post變量

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. 

...如果我設置EnableEventValidation='false',在FileUpload控制設置圖像張貼,但所有我的其他發佈值返回爲空。所以我認爲我要麼需要禁用EventValidation只是FileUpload控制,或以某種方式手動驗證它。但我不知道該怎麼做。我不知道爲什麼我的所有其他後期值應該爲空,如果EnableEventValidation設置爲false。這裏是我的對話框的標記......

<div class="divDialog" style="display: none"> 
      <table style="width: 100%;"> 
       <tr> 
        <td>First Name: <asp:TextBox ID="txtFirstName" runat="server" Text=""></asp:TextBox></td> 
        <td>Last Name: <asp:TextBox ID="txtLastName" runat="server" Text=""></asp:TextBox></td> 
       </tr> 
       <tr> 
        <td> 
         How Old are You? 
         <asp:DropDownList ID="ddlAge" runat="server"> 
          <asp:ListItem Value="1">1</asp:ListItem> 
          <asp:ListItem Value="2">2</asp:ListItem> 
          <asp:ListItem Value="3">3</asp:ListItem> 
         </asp:DropDownList> 
        </td> 
        <td> 
         How Many Siblings do You Have? 
         <asp:DropDownList ID="ddlNumberSiblings" runat="server"> 
          <asp:ListItem Value="1">1</asp:ListItem> 
          <asp:ListItem Value="2">2</asp:ListItem> 
          <asp:ListItem Value="3">3</asp:ListItem> 
          <asp:ListItem Value="4">4</asp:ListItem> 
         </asp:DropDownList> 
        </td> 
       </tr> 
       <tr> 
        <td> 
         What is your birthday? 
         <input type="text" id="datepicker" name="datepicker" /> 
        </td> 
       </tr> 
       <tr> 
        <td> 
         Please Choose a Picture to Upload: 
         <asp:FileUpload ID="fupUserPicture" runat="server" /> 
        </td> 
       </tr> 
       <tr> 
        <td> 
         <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClientClick="forcebtnHiddenClick(); return false;" /> 
        </td> 
       </tr> 
      </table> 
     </div> 

編輯:另外,這可能有關,對話框的div被附加到一個div是在窗體中,它的創建後。這裏的形式和DIV標記......

<form id="frmDialog" runat="server"> 
     <asp:Button ID="btnDisplayDialog" runat="server" Text="Click to Display Login Dialog" OnClientClick="showDialog(); return false;" /> 
     <div class="divInnerForm"></div> 

...

</div> 
<asp:Button ID="btnHidden" runat="server" Text="" Visible="false" ClientIDMode="Predictable" OnClick="btnHidden_Click"/> 

..和這裏的jQuery腳本...

function showDialog() { 
    $('.divDialog').dialog({ 
     modal: true, show: 'slide', width: 500, 
     open: function (event, ui) { 
      $('.divInnerForm').append($(this).parent()); 
     } 
    }); 
} 
+0

您的對話框是否在更新面板中? – gustavodidomenico 2013-05-09 18:46:45

+0

不,它位於表單內部的div內,但它必須在創建後使用jQuery腳本附加到此div。我現在會發布該代碼/標記... – MassStrike 2013-05-09 18:52:19

+0

只有意識到,您是否嘗試刪除「動態」行爲並觀察組件響應? – gustavodidomenico 2013-05-09 19:01:21

回答

1

問題可能嵌套形式標籤。由於你使用的是asp.net webform,我假設你有一個

<form runat="server"> 

標籤封閉頁面的主體。由於插件在div周圍創建表單標籤,因此您可能會在另一個表單標籤內嵌入表單標籤,即表單標籤。由於嵌套表單不是html投訴,所以瀏覽器會奇怪地處理這些表單。

希望這會有所幫助。

+0

不,我沒有添加另一個表單,我只是將一個類屬性添加到ASP Webforms提供的默認窗體中。所以沒有嵌套的表單或任何東西,我檢查了源頁面。 – MassStrike 2013-05-09 20:18:41