Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Datagrid Control (http://www.velocityreviews.com/forums/f60-asp-net-datagrid-control.html)
-   -   Invalid_ViewState on Postback with datagrid (http://www.velocityreviews.com/forums/t762913-invalid_viewstate-on-postback-with-datagrid.html)

TSawyerhm 08-02-2006 06:25 PM

Invalid_ViewState on Postback with datagrid
 
Hello,

This is an odd one. I have a simple datagrid that is bound to a datatable
The user gets the results by clicking a Search button. It renders with no
problems the first time. If they click Search again (the timespan doesn't
seem to make a difference), it throws Invalid_Viewstate. This happens on a
production server where SP1 for Framework 1.1 is installed, but does not
happen on a test server where SP1 has not been installed.

Here is the call stack minus the viewstate part:

[FormatException: Input string was not in a correct format.]
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo
info) +0
System.ComponentModel.Int32Converter.FromString(St ring value,
NumberFormatInfo formatInfo) +37

System.ComponentModel.BaseNumberConverter.ConvertF rom(ITypeDescriptorContext
context, CultureInfo culture, Object value) +382

[Exception: '' is not a valid value for Int32.]

System.ComponentModel.BaseNumberConverter.ConvertF rom(ITypeDescriptorContext
context, CultureInfo culture, Object value) +413

System.ComponentModel.TypeConverter.ConvertFromStr ing(ITypeDescriptorContext
context, CultureInfo culture, String text) +12
System.Drawing.ColorConverter.ConvertFrom(ITypeDes criptorContext context,
CultureInfo culture, Object value) +975
System.Web.UI.LosFormatter.ConsumeTypeConverterVal ue(String token) +220
System.Web.UI.LosFormatter.DeserializeValueInterna l() +1086
System.Web.UI.LosFormatter.DeserializeValueInterna l() +594
System.Web.UI.LosFormatter.DeserializeValueInterna l() +208
System.Web.UI.LosFormatter.DeserializeValueInterna l() +162
System.Web.UI.LosFormatter.DeserializeValueInterna l() +277
System.Web.UI.LosFormatter.DeserializeValueInterna l() +594
System.Web.UI.LosFormatter.DeserializeValueInterna l() +369
System.Web.UI.LosFormatter.DeserializeValueInterna l() +594
System.Web.UI.LosFormatter.DeserializeValueInterna l() +369
System.Web.UI.LosFormatter.DeserializeValueInterna l() +594
System.Web.UI.LosFormatter.DeserializeValueInterna l() +369
System.Web.UI.LosFormatter.DeserializeValueInterna l() +594
System.Web.UI.LosFormatter.DeserializeValueInterna l() +369
System.Web.UI.LosFormatter.DeserializeValueInterna l() +594
System.Web.UI.LosFormatter.DeserializeValueInterna l() +369
System.Web.UI.LosFormatter.DeserializeValueInterna l() +594
System.Web.UI.LosFormatter.DeserializeValueInterna l() +369
System.Web.UI.LosFormatter.DeserializeValueInterna l() +323
System.Web.UI.LosFormatter.Deserialize(String input) +332
System.Web.UI.Page.LoadPageStateFromPersistenceMed ium() +101

[HttpException (0x80004005): Invalid_Viewstate
Client IP: 149.179.232.71
Port: 2322
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
..NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.40607; InfoPath.1)

Http-Referer:
http://seam.bpweb.bp.com/HSSEInterna...uleReport.aspx
Path: /HSSEInternalBP/AuditScheduleReport.aspx.]
System.Web.UI.Page.LoadPageStateFromPersistenceMed ium() +442
System.Web.UI.Page.LoadPageViewState() +18
System.Web.UI.Page.ProcessRequestMain() +447

'' Is being passed as an arg into ColorConverter. When the datagrid is
bound, it uses the ItemBound event to set the backcolor of a cell based on
data in another cell:

e.Item.Cells(2).BackColor = mycolor.FromName(e.Item.DataItem.Item(3))

mycolor is a var from System.Drawing.Color

I know it has something to do with this, but I am confused why this happens
only on postback and from when LoadPageStateFromPersistenceMedium() is
called. I don't think page processing is even getting as far as the
ItemBound event to even call Color.FromName method. When the user clicks
Search again or even does the sorting, the datasource is repopulated
everytime ... but the page has to get to that point.

If I remove the code to look up the color, the ViewState is fine.

I don't think it's getting as far as the grid events on the postback. Has
anyone else experienced this? Does it have anything to do with SP1?

Thanks!
T


All times are GMT. The time now is 02:07 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.