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. checkbox checked event not working

checkbox checked event not working

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

    foreach (GridViewRow rw in this.grdEmpSearch.Rows) { ChkBox =(CheckBox(rw.Cells[0].FindControl("chk")); if (ChkBox.Checked) { chkCount++; } } i wrote the above code to check whether the checkbox inside a grid is checked or not but although the checkbox is not checked the above code is returning checked true is all the cases....

    G 1 Reply Last reply
    0
    • J Jipin

      foreach (GridViewRow rw in this.grdEmpSearch.Rows) { ChkBox =(CheckBox(rw.Cells[0].FindControl("chk")); if (ChkBox.Checked) { chkCount++; } } i wrote the above code to check whether the checkbox inside a grid is checked or not but although the checkbox is not checked the above code is returning checked true is all the cases....

      G Offline
      G Offline
      Gaurav Dudeja India
      wrote on last edited by
      #2

      Use this

      int checkedCount = 0;
      foreach (GridViewRow row in gvData.Rows)
      {
      bool result = ((CheckBox)row.FindControl("CheckBox1")).Checked;
      if (result)
      {
      return true;
      }
      else
      {
      return false;
      }
      }

      Gaurav Dudeja http://www.gdinfotechindia.com
      Dont be afraid of changing your life to better !

      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