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. General Programming
  3. C#
  4. CheckBoxlist Select ALl

CheckBoxlist Select ALl

Scheduled Pinned Locked Moved C#
databasewpfwcfdesignhelp
3 Posts 3 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.
  • P Offline
    P Offline
    pavithrasubbareddy
    wrote on last edited by
    #1

    I'm binding checkboxlist values from database,from UI adding ALL option to checkboxlist.When ALL option checked all values were selecting and on deselecting i need to uncheck all values. The problem is i'm checking condtion id(chk.selectedvalue!="0") then some action else select all value. The above is working fine.but the condtion !=0 will work in both deselecting ALL option as well as when select someother option in checkboxlist.

    S M 2 Replies Last reply
    0
    • P pavithrasubbareddy

      I'm binding checkboxlist values from database,from UI adding ALL option to checkboxlist.When ALL option checked all values were selecting and on deselecting i need to uncheck all values. The problem is i'm checking condtion id(chk.selectedvalue!="0") then some action else select all value. The above is working fine.but the condtion !=0 will work in both deselecting ALL option as well as when select someother option in checkboxlist.

      S Offline
      S Offline
      SaqibRasheed
      wrote on last edited by
      #2

      You are doing the string comparison which may result true in all cases. Use id(chk.selectedvalue != 0) instead of id(chk.selectedvalue != "0"). Or you can also try id(chk.Checked == false)

      1 Reply Last reply
      0
      • P pavithrasubbareddy

        I'm binding checkboxlist values from database,from UI adding ALL option to checkboxlist.When ALL option checked all values were selecting and on deselecting i need to uncheck all values. The problem is i'm checking condtion id(chk.selectedvalue!="0") then some action else select all value. The above is working fine.but the condtion !=0 will work in both deselecting ALL option as well as when select someother option in checkboxlist.

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        Change you All id to -1

        Never underestimate the power of human stupidity RAH

        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