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. asp checkbox

asp checkbox

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

    i want to add text to an asp page when the check box is ticked how do i go about this? thanks

    A 1 Reply Last reply
    0
    • M monageasmear

      i want to add text to an asp page when the check box is ticked how do i go about this? thanks

      A Offline
      A Offline
      Alsvha
      wrote on last edited by
      #2

      Well - there are a number of ways to do this, depending on what kind of text you want added - that is, if it is dynamic or static text. Basically - you could do a postback when the checkbox is checked, and then add the text when creating the page again. If the text is more static, then perhaps you could actually create the text, but make it "hide" it, then show it via JavaScript when the box is checked or simply adding it via JavaScript. But again, the "best" approch is depending on what text you wish to add and how/when it show be displayed. --------------------------- 127.0.0.1 - Sweet 127.0.0.1

      M 1 Reply Last reply
      0
      • A Alsvha

        Well - there are a number of ways to do this, depending on what kind of text you want added - that is, if it is dynamic or static text. Basically - you could do a postback when the checkbox is checked, and then add the text when creating the page again. If the text is more static, then perhaps you could actually create the text, but make it "hide" it, then show it via JavaScript when the box is checked or simply adding it via JavaScript. But again, the "best" approch is depending on what text you wish to add and how/when it show be displayed. --------------------------- 127.0.0.1 - Sweet 127.0.0.1

        M Offline
        M Offline
        monageasmear
        wrote on last edited by
        #3

        could some one post some code to get me started please sorry but im new to this development thanks in advance

        A 1 Reply Last reply
        0
        • M monageasmear

          could some one post some code to get me started please sorry but im new to this development thanks in advance

          A Offline
          A Offline
          Alsvha
          wrote on last edited by
          #4

          Well - as I said, it depends on what kind of text you wish to display. If it is static text (doesn't change much/at all) or dynamic text (changes depending on various things). If it is static text that doesn't change (much) after the page creation, then I'd simply write the text when you create the page the first time and place the styles visibility:hidden;display:none on the container in which you place the text (div tag or what not). This will hide the text from the user (still viewable in "view source" though) Then on the checkbox make a call to a JavaScript "onChange" (I think it is the onChange event - look up the JavaScript events tied to a checkbox to confirm) which then alters the styles of the container. This is perhaps a little tricky unless you have worked with JavaScript before. Alternative and perhaps easier, you could simply resubmit the form when it gets checked. Depending on if you use asp.net or asp, then there are ways to do this. Ordinary asp requiers you to use JavaScript as well, if I recall correct. And then generate the new page with the new text. You just need the form to submit/postback and then test if it is postback, and then add the text while generating the page. But this is relative basic stuff, so if you don't know how to do these things, I'd advice you to find some online beginner ressources (simply do a search on a searchengine) and then start reading up on the programming involved, then it all should fall into place :) --------------------------- 127.0.0.1 - Sweet 127.0.0.1

          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