Error saving information from an ASP.NET page to the database

Asked

Viewed 73 times

1

I have an application developed in ASP.NET (VB.NET) with two Radiobuttonlist and a Textbox where this information is returned by VB and recorded in the database, when clicking on record the system presents the error described below and the information is not entered in the database.

However when performing the same procedure in debug mode the error does not occur.

Invalid postback or callback argument. Event validation is enabled using 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.

Description: An unhandled Exception occurred During the Execution of the Current web request. Please review the stack trace for more information about the error and Where it originated in the code.

Exception Details: System.Argumentexception: Invalid postback or callback argument. Event validation is enabled using 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.

Search service.aspx

<script type="text/javascript">

    function abrirModal(id) {

        var alturaTela = $(document).height();
        var larguraTela = $(form1).width();

        var left = ($(window).width() / 2) - ($(id).width() / 2);
        var top = 100;

        $(id).css({ 'top': top, 'left': left });
        $(id).show();

    }

    $(document).ready(function ApresentaModal() {
        $("a[rel=modal]").click(function (ev) {
            ev.preventDefault();
            var id = $(this).attr("href");
            abrirModal(id);

        });
    });

    document.onload = abrirModal('#janela1');

    function close_window() {
        if (confirm("Close Window?")) {
            $('#I1').remove();
            close();
        }
    }

</script>

    <div class="janela" style="top: 100px; left: 178px; display: block;" id="janela1">
        <br />
        <div>

            <div style="float: left; width: 100%; height: 180px; border: none;">
                <div style="float: left; width: 100%;">
                    <span style="margin-left: 3px; font-size: 18px; font-family: Tahoma; font-weight: bolder; color: #0a78b7;">Por favor, atribua uma nota ao atendimento:</span>
                </div>
                <br />

                <asp:RadioButtonList ID="rblVotos" runat="server" Style="font-family: Tahoma; font-size: 0.8em; color: #043668;"
                    RepeatDirection="Horizontal">
                    <asp:ListItem>1</asp:ListItem>
                    <asp:ListItem>2</asp:ListItem>
                    <asp:ListItem>3</asp:ListItem>
                    <asp:ListItem>4</asp:ListItem>
                    <asp:ListItem>5</asp:ListItem>
                    <asp:ListItem>6</asp:ListItem>
                    <asp:ListItem>7</asp:ListItem>
                    <asp:ListItem>8</asp:ListItem>
                    <asp:ListItem>9</asp:ListItem>
                    <asp:ListItem>10</asp:ListItem>
                </asp:RadioButtonList><br />
                <div style="float: left; margin-left: 3px; width: 95%;">
                    <span style="margin-left: 3px; font-size: 0.8em; font-family: Tahoma; font-weight: bold; color: #fff;">Observações:</span>
                    <br />

                    <asp:TextBox ID="txtObs" runat="server" Columns="65" Rows="2" TextMode="MultiLine"
                        Font-Names="Tahoma" Style="font-family: Tahoma; font-size: 0.8em; color: #043668; border: none;"
                        CssClass="txtObs" Width="590" Height="120"></asp:TextBox><br />
                    <br />
                    <br />
                    <span style="margin-left: 3px; font-size: 0.8em; font-family: Tahoma; font-weight: bold; color: #0a78b7;">Todos os problemas foram resolvidos?</span>
                    <asp:RadioButtonList ID="rblProblemasResolvidos" runat="server" Style="margin-left: 3px; font-size: 0.8em; font-family: Tahoma; color: #043668;"
                        RepeatDirection="Horizontal">
                        <asp:ListItem Value="S">Sim</asp:ListItem>
                        <asp:ListItem Value="N">Não</asp:ListItem>
                    </asp:RadioButtonList><br />
                    <asp:Button ID="btnGravar" runat="server" CssClass="btnGravar" Text="Gravar"
                        Height="32px" Width="71px" />
                    <asp:Label ID="lblInformacao" runat="server" ForeColor="blue"></asp:Label>
                </div>
            </div>
        </div>
    </div>
</form>

1 answer

1

I know two solutions for you:

  1. Disable Eventvalidation by entering the code <%@ Page EnableEventValidation="false" %> at the beginning of your code (not recommend, because it loses a lot in security, but depending on your case...)
  2. Use Updatepanel, you will find more information: here and here

Browser other questions tagged

You are not signed in. Login or sign up in order to post.