jquery - Post variables not set when EnableEventValidation set to 'false' -
so have jquery dialog box within asp.net webform application post content of contained controls page. problem fileupload control. when enableventvalidation set true, suppose default, error...
invalid postback or callback argument. event validation enabled using <pages enableeventvalidation="true"/> in configuration or <%@ page enableeventvalidation="true" %> in page. security purposes, feature verifies arguments postback or callback events originate server control rendered them. if data valid , expected, use clientscriptmanager.registerforeventvalidation method in order register postback or callback data validation.
...and if set enableeventvalidation='false'
, image set in fileupload
control posted, other posted values come null. think either need disable eventvalidation
just fileupload
control, or validate manually somehow. i'm not sure how either. , don't know why other post values should come null if enableeventvalidation
set false. here's dialog markup...
<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 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 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> birthday? <input type="text" id="datepicker" name="datepicker" /> </td> </tr> <tr> <td> please choose picture 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>
edit: also, may relevant, dialog div appended div inside form after it's created. here's form , div markup...
<form id="frmdialog" runat="server"> <asp:button id="btndisplaydialog" runat="server" text="click 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"/>
..and here's jquery script...
function showdialog() { $('.divdialog').dialog({ modal: true, show: 'slide', width: 500, open: function (event, ui) { $('.divinnerform').append($(this).parent()); } }); }
the problem might nested form tags. since using asp.net webform, assume have
<form runat="server">
tag enclosing body of page. , since plugin creates form tag around div, may have nested form tags i.e. form tag inside of form tag. , since nested forms not html complaint, browsers behave weirdly processing those.
hope helps.
Comments
Post a Comment