473,769 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 ReferenceConver ter to be put in viewstate.

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

Thanks
Sarfraz

public static XmlDocument GetobjAsXmlDocu ment(object obj)

{

XmlDocument retVal = new XmlDocument();

//Convert the obj into an Xml document

XmlSerializer ser = new XmlSerializer(o bj.GetType()); StringBuilder sb = new
StringBuilder() ;

TextWriter writer = new StringWriter(sb );

ser.Serialize(w riter, obj );

StringReader reader = new StringReader(wr iter.ToString() );

//Read the Xml from the StringReader object

DataSet dst = new DataSet();

dst.ReadXml(rea der);

retVal.LoadXml( dst.GetXml());

return retVal;

}
Jul 21 '05 #1
0 1399

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

Similar topics

0
1328
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) { BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(thisStream, obj);
0
1990
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 normal XmlDoc to another I don't have any issue, the nodes are copied but then with this serialized object it doesn't seem to work. The C# code:
4
2804
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 one runat=server form on a asp.net page. However, I still want developers to be able to use asp.net controls to create some apps that are created on the page. So I need multiple forms on a asp.net page(doesn't everyone). I purchased the...
0
364
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 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...
0
1076
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 class. and Page.ViewState is not serializable. Is there any way to get serialized string of ViewState without overriding SavePageStateToPersistenceMedium ?
0
1407
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 regular pages -- just not in a control. Is the main page's viewstate interfering with the control's viewstate? Thanks,
2
1650
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 transfer all that view state information with each page (which sometimes is HUGE)... anyone have any documents on this or tutorials? thanks!
0
6616
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 object and transport it over the Internet using HTTP between a client and a server. On the other end, deserialization reconstructs the object from the stream. XML serialization serializes only the public fields and property values of an object...
5
3157
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 page? here is my to disk version: private void ser() { var fs = new FileStream(@"e:\websites\SerializedClassData", FileMode.Create);
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10222
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10050
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9999
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9866
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8876
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.