0

Right now, I am having this code and working fine. I feel this is not the right way to do. How can I do this using RadiobuttonList instead of each radio button. These are radio buttons and I am populating this using my JSON data.

 <div class="radio">
   <label><input name="SiteRadio" id="SiteRead" type="radio">Yes</label>
  </div>
  <div class="radio">
     <label><input name="SiteRadio" id="SiteReadWrite" type="radio">No</label>
   </div>
  <div class="radio">
      <label><input name="SiteRadio" id="SiteNone" type="radio">None</label>
   </div>

Here is my JSON

   if (response[0].CanRead && response[0].CanWrite) {
       $("#SiteReadWrite").prop("checked", true)                        
     } else if (response[0].CanRead) {
       $("#SiteRead").prop("checked", true)
     } else {
       $("#SiteNone").prop("checked", true)
     }
Chatra
  • 2,989
  • 7
  • 40
  • 73
  • see here http://stackoverflow.com/questions/22174475/multiple-radio-button-groups-in-mvc-4-razor/22174654#22174654 – Matt Bodily Feb 26 '15 at 20:44
  • You inputs do not even have a value attribute so not quite sure what your doing with this (it wont post back anything). –  Feb 27 '15 at 00:05

0 Answers0