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

T

Tim

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";
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top