Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 167929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:21:46+00:00 2026-05-11T12:21:46+00:00

I have a base class for some kind of user controls, and in that

  • 0

I have a base class for some kind of user controls, and in that base class and in its inherited classes I want to store some properties. I use

protected override object SaveControlState() protected override void LoadControlState(object savedState) 

methods to save or load my custom values. Since I can work only with 1 parameter of type object, I have to use some kind of list if I want to work with more than 1 variable.

I tried to do it with

[Serializable] public class ControlSate : Dictionary<string, object>, ISerializable {        void ISerializable.GetObjectData(SerializationInfo info,        StreamingContext context)     {     }      public ControlSate(SerializationInfo info, StreamingContext context)         : base(info, context)     {         }      public ControlSate()         : base()     {     } } 

but it didn’t work, and looking for a solution I have read that Dictionary is not serializable.

So, my question is what type should I use to work with a set of values in user control’s state?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T12:21:46+00:00Added an answer on May 11, 2026 at 12:21 pm

    While LoadControlState does pass you an Object it is possible for that Object to be an Object[]. In other words you are more than welcome to store an array of Objects in ControlState. I also believe that ControlState is optimized to work with the System.Web.UI.Pair type so you can create trees of objects in ControlState if you wish.

    Please read this excellent article for the best way of storing multiple values in ControlState.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume some domain and view objects (that have no common base class) public class
Lets say we have some basic AR model. class User < ActiveRecord::Base attr_accessible :firstname,
I have defined a base class with some properties like: public string CreatedByName {
I have a base class vehicle and some children classes like car, motorbike etc..
I have a base and derived class. The base class constructors have some static
I have a base class called Panel, where some information about a window is
I am writing some unit test and I have a unit testing base class
I have base class BaseClass and derived classes DerivedA , DerivedB , and DerivedC
I have a base class ( car ) and a class that inherit the
I have a bunch of stored, serialized classes (that all inherit from a base

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.