Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. ViewState Probelm in GridView

ViewState Probelm in GridView

Scheduled Pinned Locked Moved ASP.NET
cssdatabasealgorithmsquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hemant_ec48
    wrote on last edited by
    #1

    Hi ... I have bind one gridview with 2 different Method. Total 250 records are there. In first Method I fetch all 250 record in dataset and bind in Gridview with EnablePaging = True. Mean while i am saving this dataset in view state.Here grid view show only 10 records per page. So now when i see page source it display size of view state around 28 kb. In second method I fetch page wise record from DB. Means for 1st page i am fetching 10 record. and storing this dataset(with only 10 records) in view state for sorting. Now when i see page source it display the same size in view state. Is there any other technic to reduce view state?? and why happen like this in first method it fetch 250 records and i am storing it in view state while in second method i fetch only 10 records and storing in view state still view state size remain same.

    C 1 Reply Last reply
    0
    • H Hemant_ec48

      Hi ... I have bind one gridview with 2 different Method. Total 250 records are there. In first Method I fetch all 250 record in dataset and bind in Gridview with EnablePaging = True. Mean while i am saving this dataset in view state.Here grid view show only 10 records per page. So now when i see page source it display size of view state around 28 kb. In second method I fetch page wise record from DB. Means for 1st page i am fetching 10 record. and storing this dataset(with only 10 records) in view state for sorting. Now when i see page source it display the same size in view state. Is there any other technic to reduce view state?? and why happen like this in first method it fetch 250 records and i am storing it in view state while in second method i fetch only 10 records and storing in view state still view state size remain same.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Hard to say without seeing the code. What happens if you disable viewstate in the gridview, how much does it drop by then ? That will tell you how much of the viewstate is your data in the gridview

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      H 1 Reply Last reply
      0
      • C Christian Graus

        Hard to say without seeing the code. What happens if you disable viewstate in the gridview, how much does it drop by then ? That will tell you how much of the viewstate is your data in the gridview

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        H Offline
        H Offline
        Hemant_ec48
        wrote on last edited by
        #3

        Hi christian, i have already disable view state for some of the column in grid view. After binding gridview i am reading one by one row and each and every row i am go thorugh cells one by one and disable this cells enableviewState property to false. in this way if i am doing than it is reduce viewstate from 32kb to 27 kb. but problem is that first method fetch 250 records and i am storing this records in viewstate for later paging & sorting & in second method i am fetch first 10 records and storing this record in view state for later sorting only. when i click second number in paging than i am fetching record from 11 to 20 and storing this one to view state. just my problem is to when i see view source of aspx page at that time in both the case it showing me viewstate size as 27 kb only.why it is not reduced...???? In first case i have store 250 rows while in second one i have stored 10 rows in view state.. Regards, Hemant Patel.

        C 1 Reply Last reply
        0
        • H Hemant_ec48

          Hi christian, i have already disable view state for some of the column in grid view. After binding gridview i am reading one by one row and each and every row i am go thorugh cells one by one and disable this cells enableviewState property to false. in this way if i am doing than it is reduce viewstate from 32kb to 27 kb. but problem is that first method fetch 250 records and i am storing this records in viewstate for later paging & sorting & in second method i am fetch first 10 records and storing this record in view state for later sorting only. when i click second number in paging than i am fetching record from 11 to 20 and storing this one to view state. just my problem is to when i see view source of aspx page at that time in both the case it showing me viewstate size as 27 kb only.why it is not reduced...???? In first case i have store 250 rows while in second one i have stored 10 rows in view state.. Regards, Hemant Patel.

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Asking me the same question again is not helpful. Did you disable viewstate for the entire grid ? If you did, then any viewstate you're seeing, is from other things on your page.

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups