Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7721349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:54:09+00:00 2026-06-01T03:54:09+00:00

i have a problem with jquery and asp.net (the viewstate) i have a asp.net

  • 0

i have a problem with jquery and asp.net (the viewstate)

i have a asp.net page which hase some jquery code to load a other asp.net page into a div tag via ajax.

now everytime i get the error:

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

the problem is, that i cannot find the error, anybody some hints?

here is the ajax call:

function ajax_table() {
            $.get('url', function (data) {
                $('#table11').html(data);
            });
        }

and the code of the asp.net file in the url:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Querys.aspx.cs" Inherits="web.Querys" %>
<asp:MultiView ID="MultiView1" runat="server">
    <asp:View ID="View1" runat="server"><asp:Literal ID="Aus" runat="server"></asp:Literal></asp:View>
    <asp:View ID="View2" runat="server">

        <form id="form1" runat="server" enableviewstate="false">
            <asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" 
                            GridLines="None" Font-Size="8pt" Font-Names="Verdana" >
                            <AlternatingRowStyle BackColor="White" />
                            <EditRowStyle BackColor="#2461BF" />
                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                            <RowStyle BackColor="#EFF3FB" />
                            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                            <SortedAscendingCellStyle BackColor="#F5F7FB" />
                            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                            <SortedDescendingCellStyle BackColor="#E9EBEF" />
                            <SortedDescendingHeaderStyle BackColor="#4870BE" />
                        </asp:GridView>
        </form>

    </asp:View>
</asp:MultiView>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:54:10+00:00Added an answer on June 1, 2026 at 3:54 am

    I believe the problem you are having is a result of your AJAX binding “breaking the rules” of ASP.Net architecture. WebForm pages are typically designed to have one form, and in turn, one ViewState. When you call the second page via AJAX and bind it to your main page, you are adding a second (embedded) form along with it’s ViewState to the DOM, which may result in any postback events getting confused about which ViewState to use.

    The way we get round this is by adding a div container around the actual content to we want to bind (but must be within the form tag so not to include it):

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Querys.aspx.cs" Inherits="web.Querys" %>
    <form id="form1" runat="server" enableviewstate="false">
        <div id="ajaxContent"> <!-- this div -->
            <asp:MultiView ID="MultiView1" runat="server">
                <asp:View ID="View1" runat="server"><asp:Literal ID="Aus" runat="server"></asp:Literal></asp:View>
                <asp:View ID="View2" runat="server">
                    <asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" 
                        GridLines="None" Font-Size="8pt" Font-Names="Verdana" >
                        <AlternatingRowStyle BackColor="White" />
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                </asp:View>
            </asp:MultiView>
        </div>
    </form>
    

    Then in the AJAX call, only include the contents of this div:

    function ajax_table() {
        $.get('url', function (data) {
            $('#table11').html($(data).find('#ajaxContent').html());
        });
    }
    

    If you actually do need to preserve the ViewState for the embedded page (View, Literal and GridView), you’re better off using ASP.Net Ajax with UpdatePanels and such.

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem while using jquery maskedinput with asp.net textbox. I have a check
I am running into a problem trying to use AJAX and jQuery with ASP.NET
I have an ASP.NET server control which relies on JQuery for certain functionality. I've
I have the following JQuery code that worked perfect in C#/Asp.net 2.0 to call
I have an ASP.NET page where the page is making use of jQuery UI
I have some problem with Jquery Autocomplete plugin ( http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ ) I got it
I have found a problem with use JQuery timeout, i have a page with
I have ASP.NET site. At one point postback is triggered and some data is
I am using jquery 1.3.2 and asp.net mvc 1.0. Originally I was using some
I have a problem on submitting an asp.net mvc form that is using Xval

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.