syeda.naqvi
syeda.naqvi

Reputation: 33

Invalid Postback not allowing the validation

I have two listboxes that move items using javascript. The items are moving correctly but when I press the save button I get this error:

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.

My aspx:

<asp:UpdatePanel ID="update" runat="server">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnSave" />
    </Triggers>
    <ContentTemplate>         
        <table >
            <tr>
                <td>                               
                    <asp:ListBox  ID="lstbx" runat="server" ClientIDMode="Static" ></asp:ListBox>
                </td>
                <td>                           
                    <a href="#" id="movenext" class="anchor">Move ></a>
                    <a href="#" id="moveprev" class="anchor">< Move</a>
                </td>
                <td>
                    <asp:ListBox ID="lstbx2" runat="server" ClientIDMode="Static" ></asp:ListBox>
                </td>
            </tr>
        </table>
    </ContentTemplate>
</asp:UpdatePanel>

<p class="btnCentre">
    <asp:Button runat="server" ID="btnSave" Text="Save" ValidationGroup="ValGroup" CausesValidation="true"  />
    <asp:Label runat="server" ID="lbl_Savemsg"></asp:Label>
    <asp:Button runat="server" ID="btnCancel" Text="Cancel" CausesValidation="false" />
    <asp:HiddenField runat="server" ID="hiddenfield" />
</p>

Upvotes: 3

Views: 47

Answers (1)

Dev Doc
Dev Doc

Reputation: 170

you need to change enablevalidation to false
from

<pages enableEventValidation="true"/> 

to

<pages enableEventValidation="false"/>

Upvotes: 1

Related Questions