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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. checkbox viewstate disable and checked changed

checkbox viewstate disable and checked changed

Scheduled Pinned Locked Moved ASP.NET
helpcss
2 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.
  • M Offline
    M Offline
    mark_me
    wrote on last edited by
    #1

    Hi, I needed to create some controls in itemdatabound(grid) coz the number of controls to be rendered was only known at item databound of grid. the controls needed to raise event so i added events at runtime. All was working fine until recently i was asked to have another view for those controls outside the grid. I managed to create the controls once again in pageload. but the treeview was having viewstate problems coz controls once loaded and then if changed , the viewstate for the previous controls was being assigned to current controls. I managed to solve this by disabling viewstate for all the controls but now i see that the checkbox checkedchanged event is raised only when it is checked. The reason being that on pageload , since the checkbox has no viewstate, so the default value being unchecked is considered changed only if checkbox is checked. The problem gets solved when i enable viewsate but i can't enable viewstate. Is there any work around for this issue... . can the viewstate be assigned values for a particular checkbox and then removed at a button click, because there is a save button and if i can clear viewstate values at click of that button then probably it would work. I have tried clearviewstate and its not working. Please provide help Thanks haseeb

    T 1 Reply Last reply
    0
    • M mark_me

      Hi, I needed to create some controls in itemdatabound(grid) coz the number of controls to be rendered was only known at item databound of grid. the controls needed to raise event so i added events at runtime. All was working fine until recently i was asked to have another view for those controls outside the grid. I managed to create the controls once again in pageload. but the treeview was having viewstate problems coz controls once loaded and then if changed , the viewstate for the previous controls was being assigned to current controls. I managed to solve this by disabling viewstate for all the controls but now i see that the checkbox checkedchanged event is raised only when it is checked. The reason being that on pageload , since the checkbox has no viewstate, so the default value being unchecked is considered changed only if checkbox is checked. The problem gets solved when i enable viewsate but i can't enable viewstate. Is there any work around for this issue... . can the viewstate be assigned values for a particular checkbox and then removed at a button click, because there is a save button and if i can clear viewstate values at click of that button then probably it would work. I have tried clearviewstate and its not working. Please provide help Thanks haseeb

      T Offline
      T Offline
      T M Gray
      wrote on last edited by
      #2

      So the problem is with a treeview? I can't tell from your question if the gridview is relevant or even on the same page. Are you changing the viewstate setting at the control level or the page level? I am not sure what "previous controls" you are talking about either. I think your best approach is to solve the viewstate problems the treeview was having before you turned off viewstate. You should never be forced to turn off viewstate to get something to work. The gridview should provide a naming container to prevent name collisions between the two sets of controls, but maybe you are adding them in some weird way.

      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