473,401 Members | 2,139 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,401 software developers and data experts.

Problem in putting object in ViewState

Hi Friends

I have collection class implementing from IList.
Problem I am facing is I am not able to put this object in
ViewState(though it is going in Session). When I try to do
this it gives error like -- "The
type 'IListStuff.PersonCollection' must be marked as
Serializable or have a TypeConverter other than
ReferenceConverter to be put in viewstate"

So I made my class serializable as shown below,

namespace IListStuff
{
[Serializable]
public class GenericDOCollection : IList
........
}

But it is still giving me same error, I don't know about
the second part of error message i.e. TypeConvertor.

Can anybody help me in solving this problem.

Thanks

Regards
Makarand
Nov 17 '05 #1
5 2089
Does your type contain members of another class that may not be
serializable? You may have to mark particular fields as NonSerialized if
they don't support serialization.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows XP
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Makarand" <an*******@discussions.microsoft.com> wrote in message
news:09****************************@phx.gbl...
Hi Friends

I have collection class implementing from IList.
Problem I am facing is I am not able to put this object in
ViewState(though it is going in Session). When I try to do
this it gives error like -- "The
type 'IListStuff.PersonCollection' must be marked as
Serializable or have a TypeConverter other than
ReferenceConverter to be put in viewstate"

So I made my class serializable as shown below,

namespace IListStuff
{
[Serializable]
public class GenericDOCollection : IList
........
}

But it is still giving me same error, I don't know about
the second part of error message i.e. TypeConvertor.

Can anybody help me in solving this problem.

Thanks

Regards
Makarand

Nov 17 '05 #2
Hi Chris

Thanks, that was the mistake i was doing

Makarand
-----Original Message-----
Does your type contain members of another class that may not beserializable? You may have to mark particular fields as NonSerialized ifthey don't support serialization.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows XP
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Makarand" <an*******@discussions.microsoft.com> wrote in messagenews:09****************************@phx.gbl...
Hi Friends

I have collection class implementing from IList.
Problem I am facing is I am not able to put this object in ViewState(though it is going in Session). When I try to do this it gives error like -- "The
type 'IListStuff.PersonCollection' must be marked as
Serializable or have a TypeConverter other than
ReferenceConverter to be put in viewstate"

So I made my class serializable as shown below,

namespace IListStuff
{
[Serializable]
public class GenericDOCollection : IList
........
}

But it is still giving me same error, I don't know about
the second part of error message i.e. TypeConvertor.

Can anybody help me in solving this problem.

Thanks

Regards
Makarand

.

Nov 17 '05 #3
I have the same problem.

I have a custom Principal class, I have marked the "Identity" property using the XmlElement attribute as "Ignore". This works fine when I use the XML serializer to store it in a FormsAuthentication cookie, but I get the same error if I try to store it in the ViewState? Does the View State serializer not use the XML Serializer? How should I tell the serializer to ignore the "Identity" property when it's getting placed in the VIewState?

Nov 17 '05 #4
Never mind, I think you can mark it with the [NonSerialized()] attribute

Nov 17 '05 #5
No, never mind my never mind. You CAN'T mark a property as NonSerialized, only a field

You can't make the Identity property on a class implementing IPrinicipal a public field. So you can't mark it NonSerialized there either.
Nov 17 '05 #6

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

Similar topics

4
by: Stephen | last post by:
I have the following code working in order to create an array list and populate a datagrid however everytime i click my button the first item in the array and the first row in the datagrid are...
1
by: Ralph Soons | last post by:
Hi all, I am trying to save the viewstate in a session instead of storing it in a hidden of the webpage which is default. This because of performance reasons. When I use line 2 in combination...
3
by: Eyal Zinder | last post by:
Hello All, Here is a little problem I ran into. I'd like to see if anyone can help me solve it I have an HTML table that I assign to a label control. I set my Response.ContentType =...
2
by: ddaniel | last post by:
I have read many posts and seen many papers on the different techniques for sort and filtering datagrids. Many do re-queries against the dB ala Fritz Onion. I am trying to leverage the Dataview....
0
by: Mike Hofer | last post by:
Hi everyone. I could really use some help. First, the backstory: ===================== I *really* need a 3-state checkbox for my ASP.NET application. Specifically, I need one that lets me set...
3
by: Ankit Aneja | last post by:
I have a strange situation and I have no idea how to solve this. Its a Recruitment Search Page,in the Admin Page, for every button click event the Admin Person has to create a checkbox on the users...
4
by: rushikesh.joshi | last post by:
Hi All, I want to create custom control by using Web.UI.WebControls.Calendar, in which I want to set few days with different color. I had created two property to set the color and storing in...
2
by: Jarod | last post by:
Hey I change backColor of linkButton in my Page_Load: lbDoSth.BackColor = Color.Red; But I have multiView on this page. On one of the views I have detailsView. When I add a new row a set...
5
by: Slim | last post by:
i have a simple page, with one button button1. when click it creates a new button button 2 and adds a event handler to it. but when button 2 is clicked nothing happens, why? Partial Class...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...
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...

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.