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. Validating RadioButtonList Selection through Validation Controls

Validating RadioButtonList Selection through Validation Controls

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nettutorialquestion
2 Posts 2 Posters 1 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
    just4ulove7
    wrote on last edited by
    #1

    Hi, I want to validate radioButtonlist, say I want one of them to be selected before saving it. I placed a custom validator and OnServervalidate, I invoked a function to validate it. But somehow it seems that its not working, Can someone provide me guidelines as how to do it through asp.net validation controls or provide some code? Thanks

    M 1 Reply Last reply
    0
    • J just4ulove7

      Hi, I want to validate radioButtonlist, say I want one of them to be selected before saving it. I placed a custom validator and OnServervalidate, I invoked a function to validate it. But somehow it seems that its not working, Can someone provide me guidelines as how to do it through asp.net validation controls or provide some code? Thanks

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi there, In this case, you simply use a RequiredFieldValidator to validate the RadioButtonList, and remember to set the id of the radiobuttonlist in the ControlToValidate property of the validator. You also need to make sure that each item of the radiobuttonlist has its value. Another way is to always select an item by default, then you don't need any validator here to validate the control.

      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