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. how to make text box mandatory on dropdown change

how to make text box mandatory on dropdown change

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

    Hi I have one dropdown contain status information. Status are 1. Finished 2. Open 3. Progress Also one date textbox. I want to set the text box is editable and mandatory when i select the status as finished in the dropdown. Otherwise it should accept null values(not mandatory) and read only. Can any one help me please. its urgent. It should be in C# or java script Regards K7

    kesavan

    J A 2 Replies Last reply
    0
    • N NK7

      Hi I have one dropdown contain status information. Status are 1. Finished 2. Open 3. Progress Also one date textbox. I want to set the text box is editable and mandatory when i select the status as finished in the dropdown. Otherwise it should accept null values(not mandatory) and read only. Can any one help me please. its urgent. It should be in C# or java script Regards K7

      kesavan

      J Offline
      J Offline
      J4amieC
      wrote on last edited by
      #2

      I would have a requiredfieldvaliadtor on the textbox (and perhaps a regularexpressionvalidator too to ensure a date is entered) but set enabled to false. Then, when the user selects "FInished" from the dropdown, enable the validators.

      1 Reply Last reply
      0
      • N NK7

        Hi I have one dropdown contain status information. Status are 1. Finished 2. Open 3. Progress Also one date textbox. I want to set the text box is editable and mandatory when i select the status as finished in the dropdown. Otherwise it should accept null values(not mandatory) and read only. Can any one help me please. its urgent. It should be in C# or java script Regards K7

        kesavan

        A Offline
        A Offline
        Abhijit Jana
        wrote on last edited by
        #3

        You can simply implement it using AJAX Update Panel or JavaScript. You need to check the Selected value from dropdown list, and based on that you have enable/disable the Textbox. To avoid the un-necessary postback you have to use AJAX Updatepanel or Javscript :)

        Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

        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