Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Invalid_ViewState on Postback with datagrid

Reply
Thread Tools

Invalid_ViewState on Postback with datagrid

 
 
TSawyerhm
Guest
Posts: n/a
 
      08-02-2006
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception thrown Invalid_Viewstate Ganesh Ramamurthy ASP .Net 1 12-02-2005 06:49 PM
Invalid_Viewstate =?Utf-8?B?QXJuZQ==?= ASP .Net 0 09-08-2005 12:35 PM
Invalid_Viewstate =?Utf-8?B?QXJuZQ==?= ASP .Net 2 08-31-2005 01:17 AM
Invalid_Viewstate error again Jennyfer J Barco ASP .Net 3 07-08-2005 02:02 AM
Invalid_Viewstate =?Utf-8?B?Q2hyaXMgU3V0dG9u?= ASP .Net 27 05-12-2005 02:36 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57