0

I am showing the content of all pages(asp:Content) in a single page using MasterPage.master. Everything is working fine, but I am using Auto Search data in jQuery and when I click any asp button on page then I get the error message:

The state information is invalid for this page and might be corrupted.

I'm using This code:

<script type="text/javascript">
    $(function () {
        $(".search").keyup(function () {
            var inputSearch = $(this).val();
            var dataString = 'searchword=' + inputSearch;
            if (inputSearch != '') {
                $.ajax({
                    type: "POST",
                    url: "Searchlist.aspx",
                    data: dataString,
                    cache: false,
                    success: function (html) {
                        $("#divResult").html(html).show();
                    }
                });
            } return false;
        });

        jQuery("#divResult").live("click", function (e) {
            var $clicked = $(e.target);
            var $name = $clicked.find('.name').html();
            var decoded = $("<div/>").html($name).text();
            $('#search-text-input').val(decoded);
        });
        jQuery(document).live("click", function (e) {
            var $clicked = $(e.target);
            if (!$clicked.hasClass("search")) {
                jQuery("#divResult").fadeOut();
            }
        });
        $('#search-text-input').click(function () {
            jQuery("#divResult").fadeIn();
        });
    });
</script>
Michael Roland
  • 39,663
  • 10
  • 99
  • 206

2 Answers2

0

Try turning ViewState off for the control which you are calling through Jquery may be this will work

More here

Disabling the View State

MMM
  • 3,132
  • 3
  • 20
  • 32
0

try to put the following code in the web.config inside <system.web> like following

<system.web>
<machineKey validationKey="627BF72BB33AA8D28CA2C3E80920BA4DF0B726F97EEFBB0F4818350D63E6AFA380811F13ED1F086E386284654DB3"
decryptionKey="F40B6E5A02B29A181D2D213B5ED8F50B73CFCFD0CC56E137" validation="SHA1" />
</system.web>

see this to generate your own key if you want

  • Thanks , I have try to put this code in web.config , showing same error message : jQuery code is here in MasterPage.. – Sanjeev Kumar Apr 18 '15 at 07:02
  • My Application localhost working very fine , upload data on server show error message .. – Sanjeev Kumar Apr 18 '15 at 07:33
  • please see the answer here [link](http://stackoverflow.com/questions/8946374/the-state-information-is-invalid-for-this-page-and-might-be-corrupted-only-in) I believe its the same as your case , as you edit some asp.net controls using the ajax which changes the viewstate of your page – Motasem Alsaqqa Apr 18 '15 at 11:21