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. DataGrid Checkbox Column Unchecked!!

DataGrid Checkbox Column Unchecked!!

Scheduled Pinned Locked Moved ASP.NET
questiondatabasehelp
4 Posts 3 Posters 1 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.
  • N Offline
    N Offline
    NinaWilliam
    wrote on last edited by
    #1

    Hi there, I am working on a datagrid that has a column with checkboxes… the checkboxes should be checked when the page loaded. The problem is that whenever I trigger a postback, all the checkboxes will be unchecked!! I don’t know what is causing this or what should I do to prevent it from unchecking the checkboxes. Any idea?

    B M 2 Replies Last reply
    0
    • N NinaWilliam

      Hi there, I am working on a datagrid that has a column with checkboxes… the checkboxes should be checked when the page loaded. The problem is that whenever I trigger a postback, all the checkboxes will be unchecked!! I don’t know what is causing this or what should I do to prevent it from unchecking the checkboxes. Any idea?

      M Offline
      M Offline
      meeram395
      wrote on last edited by
      #2

      Try to do this:

      CheckBox ckbox = DataGrid1.FindControl("yourcheckboxcontrolId");
      chkbox.checked = true;

      Check this outside of IsPostBack during PageLoad event so that it will always be checked. Hope this helps.

      Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.

      N 1 Reply Last reply
      0
      • N NinaWilliam

        Hi there, I am working on a datagrid that has a column with checkboxes… the checkboxes should be checked when the page loaded. The problem is that whenever I trigger a postback, all the checkboxes will be unchecked!! I don’t know what is causing this or what should I do to prevent it from unchecking the checkboxes. Any idea?

        B Offline
        B Offline
        Brij
        wrote on last edited by
        #3

        Try enableviewstate as true and dont bind your gridview on postback again

        Cheers!! Brij Check my latest Article :A walkthrough to Application State

        1 Reply Last reply
        0
        • M meeram395

          Try to do this:

          CheckBox ckbox = DataGrid1.FindControl("yourcheckboxcontrolId");
          chkbox.checked = true;

          Check this outside of IsPostBack during PageLoad event so that it will always be checked. Hope this helps.

          Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.

          N Offline
          N Offline
          NinaWilliam
          wrote on last edited by
          #4

          This code solved it ^__^ thanks

          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