473,785 Members | 2,488 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 1400

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
1991
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
9645
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...
1
10091
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
9950
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...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
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.