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 6721305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:18:49+00:00 2026-05-26T09:18:49+00:00

ControlState vs ViewState I am working with a RadListBox. RadListBox has the following property

  • 0

ControlState vs ViewState

I am working with a RadListBox. RadListBox has the following property which is set to True by default: PersistClientChanges

The functionality of this property is dependent on ViewState. That is, when a change is made client-side, the changes are stored into the ViewState model for the control — and then during next postback the ViewState is parsed, the changes ‘re-run’ and applied to the control server-side.

Unfortunately, I do not have ViewState enabled on my page, and I’m not really trying to have it enabled, either. That being said, I want this functionality. So, I am looking at my other options.

The MSDN documentation states “Use control state only for small amounts of critical data that are essential for the control across postbacks. Do not use control state as an alternative to view state.”

And I am wondering:

  • What counts as a small amount of critical data? A bool? A small list of items? Less than 10000 data points??
  • What kind of gotchas should I be aware of? Is this a dumb path for me to following? Etc..

Just any other information on using ControlState properly would be nice. Thanks.

  • 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. Editorial Team
    Editorial Team
    2026-05-26T09:18:50+00:00Added an answer on May 26, 2026 at 9:18 am

    First i must admit that i’ve never used ControlState to persist values across postbacks.
    But control developers who create Controls that are used by other developers might want to use it to ensure functionality even if ViewState is disabled. Otherwise disabling would result in incorret behaviour or errors that are not obvious.

    So in my opinion you would use ControlState if you would normally use ViewState but you must ensure that the control also works when ViewState is disabled.
    In this case the sentence “Do not use control state as an alternative to view state” would be wrong, because you should use ViewState as well only for small amounts of data that must be persisted across postbacks.

    An example to clarify what i mean:

    Consider you want to create a custom control that inherits GridView. You can store the data in ViewState to maintain values across postbacks. You should allow to disable the ViewState on your control without any problems, you should not rely on the fact that it’s enabled, because developers who are using your control might want to reduce network traffic. But you could provide other properties that are stored in ControlState like SortDirection, PageIndex, DeleteButtonText etc. that you think are important and are single values, therefor less resource intensive than storing all GridViewRows.

    Edit: According to your actual problem:

    You could enable ViewState for some controls and disable it for others, but you cannot disable it for whole page and enable it for child-controls in this page.

    If you set turn page’s ViewState off, then there is no way for you to
    enable ViewState for specific components. This is because ViewState is
    serialzed recursively, so when if the Page is not allowing ViewState,
    it will not serialize the ViewState for any of it’s child controls. If
    you don’t want to explicitly turn ViewState off on individual
    controls, but want to keep some controls ViewState aware, the best way
    would be writing a small utility method which turns ViewState off for
    all controls (using recursion or otherwise). Then enable ViewState for
    the controls that you would like to enable ViewState for.
    Alternatively, a middle ground and less forceful way may possible if
    controls are groups inside other container controls (such as Panel).
    You can disable ViewState for all controls inside a Panel by disabling
    ViewState of the Panel.

    Enable ViewState for few controls and disable for others/page

    Edit: Here is an extension to enable/disable ViewState for all child-controls(VB.NET)

    <System.Runtime.CompilerServices.Extension()> _
    Public Sub EnableChildViewState(ByVal parentControl As System.Web.UI.Control, enable as Boolean) 
        If parentControl.HasControls Then
            For Each c As System.Web.UI.Control In parentControl.Controls
                c.EnableViewState = enable 
                EnableChildViewState(c, enable)
            Next
        End If
    End Sub
    

    You can call it:

    Page.EnableChildViewState(False)
    MyControl.EnableViewState = True
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Before you dive in... The ControlState is by Default set to Normal with an
I have a drop down which has a method which binds data to it:
I am working on an application in which i need to store all the
I have a UIBarButtonItem containing a button, on which I've set custom background images
In asp.net, how can I know which attributes are stored in ControlState and which
I have one GridView which has multiple columns. Here I just mentioned only the
I am am working on my app.which have requirement play video on iPhone by
I am trying to play a video in iPhone, which has m3u8 format. The
I'm trying to understand the ControlStyle property in Delphi 2007, but I'm having trouble
How to completely disable ControlState in an ASP.NET website application to get rid of

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.