Ajax, changing text in a button, and button click problem

Discussion in 'ASP .Net' started by Tim, Jul 23, 2008.

  1. Tim

    Tim Guest

    Hi all,

    I'm using AJAX.NET and I've coded a page that changes the text of a
    button when a checkbox is clicked. The text changes from "Save" to
    "Keep Processing".

    The text change seems to work. However, when I then go to click on
    the button, I click once, and nothing happens. I click again, and get
    an error:

    "System.Web.HttpException: The state information is invalid for this
    page and might be corrupted. ---> System.Web.UI.ViewStateException:
    Invalid viewstate."

    A couple things that may be the problem:
    1. I am using a content page which has a master page.
    2. My checkbox and my button are inside an asp:multiview object.

    I'm attaching my code for your review.

    Relevant page code:

    <asp:MultiView ID="Views" runat="server" ActiveViewIndex="0">
    <asp:View ID="Step1" runat="server">
    <asp:CheckBox ID="chCheck1" runat="server" Text="Automatically
    Allocate Payment" AutoPostBack="true" Checked="true" />
    <asp:updatepanel id="upSaveOrContinue" runat="server">
    <triggers>
    <asp:asyncpostbacktrigger controlid="chCheck1" />
    </triggers>
    <contenttemplate>
    <asp:Button ID="bnNext" runat="server" Text="Post Payment" />
    </contenttemplate>
    </asp:updatepanel>
    </asp:View>
    </asp:MultiView>

    And the relevant cs code:

    void ckCheck1_CheckedChanged(object sender, EventArgs e)
    {
    if (ckAutoAllocate.Checked == true)
    bnNext.Text = "Post Payment";
    else
    bnNext.Text = "Set Allocation";
    }
    Tim, Jul 23, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Purvi T
    Replies:
    0
    Views:
    821
    Purvi T
    Oct 19, 2004
  2. mike parr
    Replies:
    1
    Views:
    460
    Marina
    May 20, 2004
  3. Ben Fidge
    Replies:
    5
    Views:
    723
    S. Justin Gengo
    Jun 15, 2004
  4. Amy
    Replies:
    0
    Views:
    961
  5. minnie
    Replies:
    1
    Views:
    672
    Andrew Thompson
    Dec 13, 2006
Loading...

Share This Page