Error Serializing Value Asp.net
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How to serialize a ViewState objects up vote 0 down vote favorite I have some functions that query a database and puts the result into a gridview. It also sets a ViewState variable that contains the results of the query. When I postback, I have a load function that loads the gridview from the last results if any. The Problem I am having is that I am getting an error that basically says that the viewstate object needs to be serialized. From what I have I am not sure how to do this. Error: Sys.WebForms.PageRequestManagerServerErrorException: Error serializing value 'System.Collections.Generic.List1[<>f__AnonymousType172[System.Int32,System.String]]' of type 'System.Collections.Generic.List1[[<>f__AnonymousType172[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], App_Web_rjb524gi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].' My code so far: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Runtime.Serialization; public partial class PlayersManagement : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { LoadData(); } } public void LoadData() { if (ViewState["CurrentGridView"] != null || ViewState["CurrentGridView"] == "") { GridViewPlayers.DataSource = ViewState["CurrentGridView"]; GridViewPlayers.DataBind(); } else { DBModel.DBEntities context = new DBModel.DBEntities(); var players= (from f in context.Players where f.isDeleted == false select new { f.PlayerId, f.PlayerName }).T
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error serializing value up vote -1 down vote favorite how to know where is this thing realy happen? my abject are complicate for track and test each one , im sure there is a http://stackoverflow.com/questions/24191054/how-to-serialize-a-viewstate-objects way to find the line of this problam no? in my case im using viewstate that make this serialize , in my object there are some enum that are out of the class it might also made that issue? PropertyInfo[] properties = GetType().GetProperties(); foreach (PropertyInfo property in properties) { object[] attributes = property.GetCustomAttributes(typeof(PersistToViewState), true); if (attributes.Length > 0) ViewState[property.Name] = property.GetValue(this, null); } return base.SaveViewState(); c# serialization viewstate share|improve this question edited Mar 27 '12 at 9:08 slugster 35k968107 asked http://stackoverflow.com/questions/9886272/error-serializing-value Mar 27 '12 at 8:58 roy.d 3442522 2 Does the compiler generate an error message? If so, please post it. If the error is that something doesn't work at run-time, please state what you expected to happen and what actually happened. –JTeagle Mar 27 '12 at 9:02 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote accepted With serialisation errors, you need to see the inner exception for the actual detail. The real detail could be deep 4-5 levels but is always descriptive enough to find out what is wrong. Put the full error stack if you need more help. share|improve this answer answered Mar 27 '12 at 9:06 Aliostad 59.4k10108160 thanks i was in updatepanel and mask error so i couldnt see the exception –roy.d Mar 27 '12 at 9:44 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged c# serialization viewstate or ask your own question. asked 4 years ago viewed 1848 times active 4 years ago Related 949Serializing to JSON in jQuery4Cannot serialize Object to ViewState only Session2C# Custom Serializ
Marketing Community Engagement Ideas Answers Discussions Groups Wikis Events Mobile ReadyEvoq Intranet Governance Employee Portal Collaboration Gamification User Profiles Personalization Document Management Analytics IntegrationsEvoq: CMS FeaturesEvoq OnDemandProduct DemosCompare ProductsCompare DNN Platform http://www.dnnsoftware.com/forums/threadid/449504/scope/posts/error-serializing-value to Evoq Solutions Customer EngagementMarketing & ECommerceCustomer SupportProduct DevelopmentMember EngagementEmployee IntranetOur Customers Learn More Test DrivesSchedule A DemoWebinarsWhite PapersProduct ManualsRequest PricingData SheetsCase StudiesVideosEvoq error serializing Preferred Products Content Management Ecommerce Forms Identity Management and Authentication Site Management Social Themes Partners DNN Partners Partner Directory Become a DNN Partner Community Participate Community Exchange Community Voice Community Showcase Community Forums Working Groups Members Module ContestLearn Project History Documentation Center Community error serializing value Blog Video Library Wiki Development Online Help RoadmapConnect DNN MVP Community Leaderboard Community Newsletters Community Events Community HangoutDownload DNN Forge Language Packs Manuals Nightly BuildsSecurity Policies Security Center Blog About Leadership Management InvestorsNews Press Releases News Coverage Press KitCareersContact DNN Download DNN Platform Whitepapers Manuals Support Store DNN Modules DNN Themes Store Blog Evoq Preferred Services Login REGISTERBecome a DNNizen > Submit DNN Products Evoq Content Overview Content Creation Workflow Asset Management Mobile Responsive Personalization Content Analytics SEO Integrations Security Website Performance Evoq Engage Overview Community Management Gamification Advocate Marketing Communit