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. Check all - checkbox

Check all - checkbox

Scheduled Pinned Locked Moved ASP.NET
question
6 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.
  • N Offline
    N Offline
    nour123
    wrote on last edited by
    #1

    Hi all I have a user privilages form, How can I make a checkbox that checks all the checkboxes in a form ? Thanks

    Nour Abdel-Salam... A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)

    N 1 Reply Last reply
    0
    • N nour123

      Hi all I have a user privilages form, How can I make a checkbox that checks all the checkboxes in a form ? Thanks

      Nour Abdel-Salam... A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      There are several ways, client-side JavaScript to server-side events. Clarify your requirements and you may get a more precise answer.


      only two letters away from being an asset

      N 1 Reply Last reply
      0
      • N Not Active

        There are several ways, client-side JavaScript to server-side events. Clarify your requirements and you may get a more precise answer.


        only two letters away from being an asset

        N Offline
        N Offline
        nour123
        wrote on last edited by
        #3

        Hi Mark I prefer to get the server side events if it possible.. Regards

        Nour Abdel-Salam... A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)

        P 1 Reply Last reply
        0
        • N nour123

          Hi Mark I prefer to get the server side events if it possible.. Regards

          Nour Abdel-Salam... A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)

          P Offline
          P Offline
          pmartike
          wrote on last edited by
          #4

          Checkboxes has a CheckedChange event where you can verify if that checkbox is checked or not, and you check or uncheck the other checkboxes. You can use Ajax Update panel if you want to do this without refreshing your page :) Ex: protected void allTotals_CheckedChanged(object sender, EventArgs e) { if (allTotals.Checked) { customTotals1.Checked = false; customTotals2.Checked = false; customTotals3.Checked = false; customTotals4.Checked = false; .... } else { customTotals1.Checked = true; customTotals2.Checked = true; customTotals3.Checked = true; customTotals4.Checked = true; .... } }

          -------------------------------- visit: http://pmartike.deviantart.com/

          N N 2 Replies Last reply
          0
          • P pmartike

            Checkboxes has a CheckedChange event where you can verify if that checkbox is checked or not, and you check or uncheck the other checkboxes. You can use Ajax Update panel if you want to do this without refreshing your page :) Ex: protected void allTotals_CheckedChanged(object sender, EventArgs e) { if (allTotals.Checked) { customTotals1.Checked = false; customTotals2.Checked = false; customTotals3.Checked = false; customTotals4.Checked = false; .... } else { customTotals1.Checked = true; customTotals2.Checked = true; customTotals3.Checked = true; customTotals4.Checked = true; .... } }

            -------------------------------- visit: http://pmartike.deviantart.com/

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #5

            More efficient code protected void allTotals_CheckedChanged(object sender, EventArgs e) { customTotals1.Checked = allTotals.Checked; customTotals2.Checked = allTotals.Checked; customTotals3.Checked = allTotals.Checked; customTotals4.Checked = allTotals.Checked; } Or even better yet, put the checkboxes in a container protected void allTotals_CheckedChanged(object sender, EventArgs e) { foreach(CheckBox c in Panel1.Controls) c.Checked = allTotals.Checked; }


            only two letters away from being an asset

            1 Reply Last reply
            0
            • P pmartike

              Checkboxes has a CheckedChange event where you can verify if that checkbox is checked or not, and you check or uncheck the other checkboxes. You can use Ajax Update panel if you want to do this without refreshing your page :) Ex: protected void allTotals_CheckedChanged(object sender, EventArgs e) { if (allTotals.Checked) { customTotals1.Checked = false; customTotals2.Checked = false; customTotals3.Checked = false; customTotals4.Checked = false; .... } else { customTotals1.Checked = true; customTotals2.Checked = true; customTotals3.Checked = true; customTotals4.Checked = true; .... } }

              -------------------------------- visit: http://pmartike.deviantart.com/

              N Offline
              N Offline
              nour123
              wrote on last edited by
              #6

              Thanks alot sir and how can I do it using Javascript? Regards

              Nour Abdel-Salam... A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)

              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