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. Page fails to load when arraylist being saved in Viewstate

Page fails to load when arraylist being saved in Viewstate

Scheduled Pinned Locked Moved ASP.NET
helpquestion
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.
  • D Offline
    D Offline
    deep7
    wrote on last edited by
    #1

    Hi, I'm facing problem when i load page with dynamically created controls. This happens if i save a arraylist in viewstate. ViewState["Delim"] = arrList; I searched the net, and found that we can save arraylists in viewstate, and that try saving it in page_preRender. I did so, but same issue. If i save some string in viewstate instead, it doesn't have any problems loading the dynamic controls. Anyone can help me here, to resolve this? Thanks, Deepa

    A 1 Reply Last reply
    0
    • D deep7

      Hi, I'm facing problem when i load page with dynamically created controls. This happens if i save a arraylist in viewstate. ViewState["Delim"] = arrList; I searched the net, and found that we can save arraylists in viewstate, and that try saving it in page_preRender. I did so, but same issue. If i save some string in viewstate instead, it doesn't have any problems loading the dynamic controls. Anyone can help me here, to resolve this? Thanks, Deepa

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      deep7 wrote:

      I'm facing problem when i load page with dynamically created controls

      Where did you create those control ? You should have to create dynamic control before page_load to holds the ViewState.

      deep7 wrote:

      and that try saving it in page_preRender.

      I guess, Before PreRender, all viewstate data are saved. :)

      Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

      D 1 Reply Last reply
      0
      • A Abhijit Jana

        deep7 wrote:

        I'm facing problem when i load page with dynamically created controls

        Where did you create those control ? You should have to create dynamic control before page_load to holds the ViewState.

        deep7 wrote:

        and that try saving it in page_preRender.

        I guess, Before PreRender, all viewstate data are saved. :)

        Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

        D Offline
        D Offline
        deep7
        wrote on last edited by
        #3

        Hi, Dynamic controls are created in page load. Also, is it something to do with declaration of Arraylist? I declare it as global variable. I tried saving the arraylist object in page load after controls are generated. But still same problem. Please note, the arraylist contains objects of a particular class. Is it a problem? I dont get it...it goes to the Application_Error event in global.asax.cs. How do i resolve this? i need to store the arraylist in viewstate, because i require it on one button click event.

        A 1 Reply Last reply
        0
        • D deep7

          Hi, Dynamic controls are created in page load. Also, is it something to do with declaration of Arraylist? I declare it as global variable. I tried saving the arraylist object in page load after controls are generated. But still same problem. Please note, the arraylist contains objects of a particular class. Is it a problem? I dont get it...it goes to the Application_Error event in global.asax.cs. How do i resolve this? i need to store the arraylist in viewstate, because i require it on one button click event.

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #4

          deep7 wrote:

          Dynamic controls are created in page load.

          As I already mention Dynamic Control Can be created on Page_Load, BUT If you create dynamic control on Page_Load() or after, It will not able to load Postback data and View State Data. Because, LoadViewState and LoadPostback data called before the Page_Load() in ASP.NET Page Life Cycle.

          Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

          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