Results 1 to 4 of 4

Thread: How to turn off View State of Datagrid

  1. #1
    Join Date
    Feb 2009
    Posts
    78

    How to turn off View State of Datagrid

    I have developed an application in PHP background where i set the clean URLs to grab data from one service to another. However, on some of my ASP.NET projects I get the horrible ViewState parameter in my URLs. and therefore i have decided to Disable view state for a page, but I'm still getting lots of viewstate data in my hidden form field. Is there a way to turn this off globally?

  2. #2
    Join Date
    Feb 2009
    Posts
    45

    Re: How to turn off View State of Datagrid

    I believe the <pages> (case is important) setting goes in the <system.web> section, and *not* in the <appSettings> section. Actually, it is a collection of 3 values, first one being the page hash, second is the sum of all the viewstates of every control in the page (which is the very content of the viewstate and would be empty in your case) and the third being an array of all the registered controls that require a postback. If you could provide us with a sample project/solution demonstrating the issue and the exact repro steps, we would still like to address the issue. You can see these values for yourself as by default the viewstate is not encrypted and it is just a base64 encoded string.

  3. #3
    Join Date
    Nov 2008
    Posts
    27

    Re: How to turn off View State of Datagrid

    ViewState is a hidden field that is sent to the server with a postback (which normally uses post). It keeps the state of the controls when the page was rendered to the client, sending it with each postback. I was unable to produce a NEW project with the same problem. But I extracted my control to a standalone page and still get the problem, no matter where I place the "EnableViewstate=False" attribute, my viewstate doesn't change size.

  4. #4
    Join Date
    Nov 2008
    Posts
    29

    Re: How to turn off View State of Datagrid

    The view state of a page is, by default, placed in a hidden form field named __VIEWSTATE. I disabled ViewState for the grid by setting its EnableViewState property to false. ViewState can be disabled for a single control, for an entire page. it is a good practice to turn off viewstate (if you are sure it is not needed) as it will reduce the size of your page. The purpose of ViewState is to provide the illusion that various page and control properties persist from one request to the next.

Similar Threads

  1. Replies: 2
    Last Post: 18-01-2012, 05:44 PM
  2. How to create a query on datagrid view in vb.net
    By Ainsley in forum Software Development
    Replies: 3
    Last Post: 10-12-2009, 09:59 PM
  3. Replies: 3
    Last Post: 31-07-2009, 01:09 PM
  4. How can I get the row count from DataGrid?
    By Shashikant in forum Software Development
    Replies: 4
    Last Post: 04-02-2009, 11:47 PM
  5. Replies: 4
    Last Post: 26-11-2008, 01:41 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,216,067.14045 seconds with 16 queries