473,398 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

xml serialized object in viewstate

I have created an object which can bind to Microsoft DataGrid no issues but
now i have to bind that object to a 3rd party Grid. When i bind my object to
that grid's datasource what it does internally is save my object in
viewstate. So my object has to be serializable in order to get stored in
viewstate. I am using code mentioned below for serialization but it gives me
this error when i try to bind it. I can see the serialized xmldocument
object after serialization and it is perfectly ok.

The type 'u' must be marked as Serializable or have a TypeConverter other
than ReferenceConverter to be put in viewstate.

My object is a collection I am wondering if I am missing something here.

Thanks
Sarfraz

public static XmlDocument GetobjAsXmlDocument(object obj)

{

XmlDocument retVal = new XmlDocument();

//Convert the obj into an Xml document

XmlSerializer ser = new XmlSerializer(obj.GetType()); StringBuilder sb = new
StringBuilder();

TextWriter writer = new StringWriter(sb);

ser.Serialize(writer, obj );

StringReader reader = new StringReader(writer.ToString());

//Read the Xml from the StringReader object

DataSet dst = new DataSet();

dst.ReadXml(reader);

retVal.LoadXml(dst.GetXml());

return retVal;

}
Jul 21 '05 #1
0 1363

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ray Mitchell | last post by:
Hello, The result of auto-converting some Java code to C# yielded the following upgrade issue regarding the original Java call to "reset()": public virtual void writeObj(Object obj) {...
0
by: Pierre | last post by:
Hi, I'm trying to select specific nodes from a XmlDocument filled with a serialized object and to insert these nodes into another XmlDocument. The object is well serialized (see below). From a...
4
by: Kevin Phifer | last post by:
Ok, before anyone freaks out, I have a solution I need to create that gathers content from maybe different places. Each one can return a <form> in the html, so its the classic can't have more than...
0
by: Sarfraz Hooda | last post by:
I have created an object which can bind to Microsoft DataGrid no issues but now i have to bind that object to a 3rd party Grid. When i bind my object to that grid's datasource what it does...
0
by: madani | last post by:
Hi, I need to get serialized string of Page ViewState in Constructor of my custom web control. I can not override SavePageStateToPersistenceMedium Method of page object because I'm in different...
0
by: bminder | last post by:
I have a web user control that contains a serializable class. I persist this class in viewstate, but on postback, the viewstate is null. Is this behavior by design? This technique works fine on...
2
by: Smokey Grindel | last post by:
I heard somewhere that in at least ASP.NET 2.0 you can remove the serialized view state from a page and have it stored locally in SQL server ot the ASP.NET state server service? so it doesnt...
0
by: bharathreddy | last post by:
Before going to that i want to say few thing on serialization : Serialization is the process of converting an object into a form that can be readily transported. For example, you can serialize an...
5
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I can very simple save a serilized class to a server, but i don't know how to serilize an object (here a business object) to a variable so that it can be saved to viewstate or passed to another...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.