Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 6th, 2012  |  syntax: None  |  size: 1.14 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to give names for dynamically generated radiobuttonfor
  2. @{int questionCount = 0;
  3.  }
  4. @{foreach (SectionDetail sectionDetail in section.SectionDetails)
  5.  {                              
  6.     <table>
  7.         <tr>
  8.             <td>
  9.                 @Html.Label(sectionDetail.Title)
  10.             </td>
  11.             @{count = 0;
  12.             }
  13.             @foreach (SectionScore sectionScore in Model.IndividualSections)
  14.             {
  15.  
  16.                 <td class="ColSupplier">
  17.                     @Html.RadioButtonFor(model => model.IndividualSections[count].SectionScores[questionCount].score.pass, true)Pass
  18.                     @Html.RadioButtonFor(model => model.IndividualSections[count].SectionScores[questionCount].score.pass, false)Fail
  19.                 </td>
  20.                count++;
  21.             }
  22.         </tr>
  23.     </table>
  24.  
  25.     questionCount++;
  26.   }
  27.        
  28. @(Html.RadioButtonFor(model => model.IndividualSections[count].SectionScores[questionCount].score.pass, true, new {@id=sectionDetail.Title + count.Tostring() }) ))
  29.        
  30. @Html.RadioButtonFor(model => model.IndividualSections[count].SectionScores[questionCount].score.pass, true, new { id= count.ToString()});