I am having a problem with the callback panel:
The page has 2 primary parts:
1) A composite custom data control that uses callback to update. (nothing special (written by me))
2) An eo callback panel with several server controls that I use to add new records.
Here's what happens:
1) put something in server controls in callback panel.
2) execute server action that inserts the record.
3) clear server controls in callback panel.
4) run client script that triggers callback that updates the data control. (ClientSideAfterUpdate="callbackExecRet")
5) put something else in server controls in callback panel.
6) execute server action that inserts the record.
7) get the following error:
Server Error in '/PSHPWeb' Application.
The state information is invalid for this page and might be corrupted.
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.Web.HttpException: The state information is invalid for this page and might be corrupted.
Source Error:
[No relevant source lines]
Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\pshpweb\20a1b179\847e3118\App_Web_svmvfno-.2.cs Line: 0
Stack Trace:
[ViewStateException: Invalid viewstate.
Client IP: 127.0.0.1
Port:
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Embedded Web Browser from:
http://bsalsa.com/; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30)
ViewState: /wEWGQKdo+PjDAL7jsehBALkjsehBALljsehBAK12e7wBAK8tsSeCAKttsSeCAK6trydCAK4tsSeCAK+tsSeCAK7tsSeCAK6trSdCAK5tsSeCAK6tqCdCAK6tridCAK6tsSeCAKitsSeCAK6trCdCAK/tsSeCAK6toidCAK6toydCAK6toSdCAL+zqO2BALc3uCnBAKP6PmbATuoAXuhQ+L/K7kNZWggI9hLcnNI
Referer: http://localhost:35555/PSHPWeb/Secure/SingleRecord.aspx?ttype=sales&tvar=116979&fn=Jerry&ln=Rickenbach
Path: /PSHPWeb/Secure/SingleRecord.aspx]
[HttpException (0x80004005): The state information is invalid for this page and might be corrupted.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +116
System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded() +321
System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +67
System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +106
System.Web.UI.WebControls.ListBox.LoadPostData(String postDataKey, NameValueCollection postCollection) +120
System.Web.UI.WebControls.ListBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +11
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +408
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6978
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.secure_singlerecord_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\pshpweb\20a1b179\847e3118\App_Web_svmvfno-.2.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +303
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832
here is the code that runs the behind the form (partial)
protected void LinkButton1_Click(object sender, EventArgs e)
{
if(Page.IsValid)
{
StringBuilder sb = new StringBuilder();
sb.Append("p_iu_cpgContactSales 0,");
sb.Append(WFLcontrols.StringValidation.SQLValidateNumber(Request.QueryString["tvar"].ToString()) + ", ");
sb.Append(Session["userid"].ToString() + ", ");
sb.Append(this.ListBox1.SelectedValue + ", ");
sb.Append("'" + this.DatePicker1.SelectedDate.ToString("g") + "',");
sb.Append("'" + "" + "', "); //time info
sb.Append(this.DropDownList1.SelectedValue + ", ");
sb.Append((this.CheckBox1.Checked ? "1" : "0") + ", ");
sb.Append("'" + WFLcontrols.StringValidation.SQLValidateString(WFLcontrols.StringValidation.SQLReplaceSingleQuote(this.TextBox1.Text)) + "'");
int ret = WFLcontrols.GenericData.RunNonQuery(sb.ToString(), false, WebConfigurationManager.ConnectionStrings["local"].ConnectionString);
if(ret == 1)
{
ListBox1.SelectedIndex = -1;
DatePicker1.SelectedDate = DateTime.Now;
this.DropDownList1.SelectedIndex = -1;
CheckBox1.Checked = false;
TextBox1.Text = string.Empty;
}
else
{
Response.Write("The update failed. If this problems persists, please contact technical support.");
}
}
}
protected void CallbackPanel1_Execute(object sender, EO.Web.CallbackEventArgs e)
{
e.Data = "true";
}
and partial page code:
<cc1:DataTab ID="DataTabLeadManagement" runat="server" OnRequestData="DataTabLeadManagement_OnRequestData"
OnAction="DataTabLeadManagement_OnAction" EnableViewState="false" />
<eo:CallbackPanel ID="CallbackPanel1" runat="server" Width="100%" ClientSideAfterUpdate="callbackExecRet"
OnExecute="CallbackPanel1_Execute" Visible="false" Triggers="{ControlID:LinkButton1;Parameter:}">
<asp:Panel ID="Panel5" runat="server">
<div style="padding-left:40px; padding-top: 25px">
<table style="width:700px" cellpadding="0" cellspacing="0" border="0" class="tableAlt">
<colgroup>
<col style="width:100px" /><col style="width:250px" /><col style="width:100px" /><col style="width:150px" />
</colgroup>
<tr><td colspan="4" style="text-align:center; font-weight:bold">New Sales Action</td></tr>
<tr>
<td class="tdTitle" >Contact Type</td>
<td >
<asp:ListBox ID="ListBox1" runat="server" Height="55px">
<asp:ListItem Value="0">Phone Call</asp:ListItem>
<asp:ListItem Value="1">Appointment</asp:ListItem>
<asp:ListItem Value="2">Other</asp:ListItem>
</asp:ListBox><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ErrorMessage="Please select a contact type." ControlToValidate="ListBox1"></asp:RequiredFieldValidator>
</td>
<td class="tdTitle">Status of Contact</td>
<td >
<asp:DropDownList ID="DropDownList1" runat="server" Width="217px">
<asp:ListItem></asp:ListItem>
</asp:DropDownList><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ErrorMessage="Please fill in the status." ControlToValidate="DropDownList1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="tdTitle">Date and Time</td>
<td valign="middle">
<eo:DatePicker id="DatePicker1" runat="server" DayHeaderFormat="FirstLetter" TitleLeftArrowImageUrl="DefaultSubMenuIconRTL"
DayCellHeight="16" OtherMonthDayVisible="True" DayCellWidth="19" TitleRightArrowImageUrl="DefaultSubMenuIcon"
ControlSkinID="None" PickerFormat="MM/dd/yyyy hh:mm tt">
<DayHoverStyle CssText="border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid"></DayHoverStyle>
<TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;"></TitleStyle>
<DayHeaderStyle CssText="border-bottom: #aca899 1px solid"></DayHeaderStyle>
<DayStyle CssText="border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid"></DayStyle>
<SelectedDayStyle CssText="background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid"></SelectedDayStyle>
<TitleArrowStyle CssText="cursor:hand"></TitleArrowStyle>
<TodayStyle CssText="border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid"></TodayStyle>
<PickerStyle CssText="font-family:Courier New; padding-left:5px; padding-right: 5px;"></PickerStyle>
<OtherMonthDayStyle CssText="color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid"></OtherMonthDayStyle>
<CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma"></CalendarStyle>
<DisabledDayStyle CssText="color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid"></DisabledDayStyle>
<MonthStyle CssText="font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px; font-family: tahoma"></MonthStyle>
<PopupExpandEffect Duration="300" Steps="4" Type="Fade" />
<PopupCollapseEffect Duration="300" Steps="4" Type="Fade" />
</eo:DatePicker>
</td>
<td class="tdTitle">Finished</td>
<td>
<asp:CheckBox ID="CheckBox1" runat="server" Text=" " />
</td>
</tr>
<tr>
<td class="tdTitle">Notes</td>
<td colspan="3">
<asp:TextBox ID="TextBox1" runat="server" Width="100%"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="4" style="text-align:right; vertical-align:middle; height: 30px;">
<span style="padding-right:100px"><asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">Submit this Sales Action</asp:LinkButton></span>
</td>
</tr>
</table>
</div>
</asp:Panel>
</eo:CallbackPanel>
function callbackExecRet(callback, output, vars){
wfl_DataTabLeadManagement_callBackServerConc('getdata', 0, $get('leadid').value);
}
I have seen other problems with invalid viewstate. Any ideas?