所以我在ASP.NET WebForm应用程序中有一个jQuery对话框,我将所有包含的控件的内容发布到另一个页面。问题是FileUpload控件。当EnablEventValidation设置为true时,我认为默认情况下,我收到此错误...
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
控件中设置的图像会被过帐,但我所有其他发布的值都会返回为空。所以我想我需要为{em> EventValidation
控件禁用FileUpload
,或以某种方式手动验证它。但我不知道该如何做。如果EnableEventValidation
设置为false,我不知道为什么我的所有其他帖子值都应为null。这是我的对话标记......
<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 :(得分:1)
问题可能是嵌套的表单标记。由于您使用的是asp.net webform,我假设您有
<form runat="server">
标记包含页面的主体。由于插件在div周围创建了一个表单标记,因此您可以使用嵌套的表单标记,即另一个表单标记内的表单标记。由于嵌套表单不是html投诉,浏览器表现得奇怪地处理那些。
希望这有帮助。