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. Accesing control value in GridView on postback

Accesing control value in GridView on postback

Scheduled Pinned Locked Moved ASP.NET
csharpcsshelpquestion
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.
  • A Offline
    A Offline
    Aftab Sindhi
    wrote on last edited by
    #1

    I've a user control, which contains GridView. The gridview is bound to the ObjectDataSource. The gridview is displaying checkboxes in the shape of matrix like below

    Title

    View

    Insert

    Edit

    Users

    checkbox

    checkbox

    checkbox

    Page Data

    checkbox

    checkbox

    checkbox

    The columns and Titles are dynamic, which is generated by the object(which is used by ObjectDataSource). The data of the grid is displayed correctly without any problem. Under the grid there is button. On the button click I want to know, which check boxes are checked. I can loop through every row of the grid and can access the checkbox also. Now, problem is, on button click when I am looping through gridview rows, all checkboxes are shown as unchecked while before click I check some checkboxes. Strange behavior is this, that, on 1st click, checkboxes are not retaining checked state, while on 2nd click, same code shows checked check boxes correctly. In short, problem is on 1st click, while subsequent clicks are working as expected. Is there anybody who can tell whats wrong?

    Regards Aftab Sindhi .NET Application Developer U.A.E

    S 1 Reply Last reply
    0
    • A Aftab Sindhi

      I've a user control, which contains GridView. The gridview is bound to the ObjectDataSource. The gridview is displaying checkboxes in the shape of matrix like below

      Title

      View

      Insert

      Edit

      Users

      checkbox

      checkbox

      checkbox

      Page Data

      checkbox

      checkbox

      checkbox

      The columns and Titles are dynamic, which is generated by the object(which is used by ObjectDataSource). The data of the grid is displayed correctly without any problem. Under the grid there is button. On the button click I want to know, which check boxes are checked. I can loop through every row of the grid and can access the checkbox also. Now, problem is, on button click when I am looping through gridview rows, all checkboxes are shown as unchecked while before click I check some checkboxes. Strange behavior is this, that, on 1st click, checkboxes are not retaining checked state, while on 2nd click, same code shows checked check boxes correctly. In short, problem is on 1st click, while subsequent clicks are working as expected. Is there anybody who can tell whats wrong?

      Regards Aftab Sindhi .NET Application Developer U.A.E

      S Offline
      S Offline
      Suresh Pirsquare
      wrote on last edited by
      #2

      Aftab Sindhi wrote:

      In short, problem is on 1st click, while subsequent clicks are working as expected.

      Just Debug the code.

      Everything Is Possible!

      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