Error Serializing Value Of Type System Data Datatable
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 Store DataTable in view state up vote -2 down vote favorite I think I found it :D, wrong data :D – steve jobs I have a datatable object I want to store it in Viewstate but some times an error occurred (not usual Error: Sys.WebForms.PageRequestManagerServerErrorException: Error serializing value 'Table1' of type 'System.Data.DataTable.' Any help Please c# asp.net datatable share|improve this question edited May 30 '12 at 21:33 Henk Holterman 182k17175320 asked May 30 '12 at 8:09 steve jobs 46212 1 if you are storing a large amount of rows and columns, ViewState might not be the best storage medium for you. –Sunny May 30 '12 at 8:16 no, it not a big data I have only 5 rows, and I don't know why its working sometime and sometimes not –steve jobs May 30 '12 at 8:31 add a comment| 2 Answers 2 active oldest votes up vote 1 down vote accepted The problem that you are facing is because of size of datatable. Storing datatable in ViewState is not a good practice as it increases the size of your page and reduces the performance, also ViewState can be deciphered on the client side, so the DataTable is not secure. You can do it through sessions or more better from Cache and if it is not being used frequently I suggest you to requery it from database. share|improve this answer answered May 30 '12 at 8:35 Imran Balouch 1,6681134 the issue is I want to do some modification on the Datatable that is why I want to keen a temp version, and I use a view state ti ensure it's removed when I leave a page –steve jobs May 30 '12 at 8:39 What are the values present in the datatable, if you store an unserializable object in a table, then the table is no more serilizable. you will need to write a serializer/deserialzer for each of your controls. –Imran Balouch May 30 '12 at 8:40 I think I found it :D, wrong data :D –steve jobs May 30 '12 at 9:05 Cheers, thats great –Imran Balouch May 30
SQL Server 2014 Express resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation APIs and reference Dev centers Retired content Samples We’re sorry. The content you requested has been removed. You’ll be auto redirected in 1 second. Ask a question Quick access Forums home Browse forums users FAQ Search http://stackoverflow.com/questions/10812376/store-datatable-in-view-state related threads Remove From My Forums Answered by: Datatable Serialization Issue Archived Forums V > Visual C# Language Question 0 Sign in to vote Hi all, please find the below code [Serializable] public class ViewDTO { public DataTable EventLog {get;set;} public DataTable ErrorLog {get;set;} } i have 1.5 https://social.msdn.microsoft.com/Forums/en-US/81d42a17-4492-4e89-98f8-a3a3b83cd955/datatable-serialization-issue?forum=csharplanguage lakh rows with 15 columns in EventLog datatable and 1 lakh rows with 10 columns in ErrorLog datatable. when i try to serialize this class object am getting below error: Exception of type 'System.OutOfMemoryException' was thrown. what is the maximum data rows limit for serializing datatable object. Can you please suggest me if there is any other way to do it. StackTrace: at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity) at System.Text.StringBuilder.GetNewString(String currentString, Int32 requiredLength) at System.Text.StringBuilder.Append(String value) at System.IO.StringWriter.Write(String value) at System.Xml.XmlTextWriter.InternalWriteEndElement(Boolean longFormat) at System.Xml.XmlTextWriter.WriteEndElement() at System.Data.DataTextWriter.WriteEndElement() at System.Data.XmlDataTreeWriter.XmlDataRowWriter(DataRow row, String encodedTableName) at System.Data.XmlDataTreeWriter.Save(XmlWriter xw, Boolean writeSchema) at System.Data.DataTable.WriteXml(XmlWriter writer, XmlWriteMode mode, Boolean writeHierarchy) at System.Data.DataTable.WriteXml(TextWriter writer, XmlWriteMode mode, Boolean writeHierarchy) at System.Data.DataTable.WriteXml(TextWriter writer, XmlWriteMode mode) at Carrick.Framework.DTO.EventsListViewResponseDTO.GetObjectData(SerializationInfo info, StreamingContext context) in D:\Work_iQPlus\Carrick\Carrick.Framework\DTO\EventsListViewResponseDTO.cs:line 211 at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.I
Guest if you store an unserializable object in a table, then it is no longer serilizable. you will need to write a serializer/deserialzer for each of your controls. -- bruce (sqlwork.com) Adam wrote: > http://www.pcreview.co.uk/threads/re-error-serializing-value-table1-of-type-system-data-datatable.2886194/ I need to store a collection of dynamically loaded controls in my User > https://bytes.com/topic/c-sharp/answers/267468-dataview-not-serializable Control. Each control is linked to a headerid and a headerid can have many > controls. My first dead end was to use a List
question and get tips & solutions from a community of 418,545 IT Pros & Developers. It's quick & easy. Dataview is not serializable P: n/a Raghavendra Tilve Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is 'StateServer' or 'SQLServer'. 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: Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is 'StateServer' or 'SQLServer'. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: Hi, I am getting the error when i do SessionState SQlserver inn web.config [SerializationException: The type System.Data.DataView in Assembly System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 is not marked as serializable.] System.Runtime.Serialization.FormatterServices.Int ernalGetSerializableMember s(RuntimeType type, Boolean excludeNonSerializable) +868 System.Runtime.Serialization.FormatterServices.Get SerializableMembers(Type type, StreamingContext context) +300 System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitMemberInf o() +103 System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitSerialize (Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +493 System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.Serialize(Obj ect obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +48 System.Runtime.Serialization.Formatters.Binary.Obj ectWriter.Write(WriteObjec tInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) +515 System.Runtime.Serializat