title: How to correctly display radiobutton in asp.net mvc 5
body: <p>I want to know what is the best way to display a group radio buttons in asp.net mvc 5 application.</p>
  
  <p>Attempt 1:</p>
  
  <pre><code>    @Html.RadioButton("SearchBy", "Name", true) &lt;text&gt; Name &lt;/text&gt;
      @Html.RadioButton("SearchBy", "Location") &lt;text&gt; Location&lt;/text&gt;
  
  
      [HttpPost]
      public ActionResult Create(CoverLetterViewModel viewModel, string searchBy)
      {//somecode}
  </code></pre>
  
  <p>Attempt 2:</p>
  
  <pre><code>     //prop
         public string SelectedRoleType { get; set; }
       //view
         &lt;label&gt;
              @Html.RadioButtonFor(m =&gt; m.SelectedRoleType, "JobSeeker", new { @class = "js-radio", id = "" })
              &lt;span&gt;Job Seeker&lt;/span&gt;
          &lt;/label&gt;
  
          &lt;label&gt;
              @Html.RadioButtonFor(m =&gt; m.SelectedRoleType, "Referrer", new { @class = "js-radio", id = "" })
              &lt;span&gt;Referrer&lt;/span&gt;
          &lt;/label&gt;
        //controller action
          [HttpPost]
          public ActionResult Create(CoverLetterViewModel viewModel)
          {//somecode}
  </code></pre>
  
  <p>Attempt 3:
  Now suppose I have 10 radiobutton, is there any efficient way to create radiobutton. I mean suppose I have a list of radiobuttonitem, Something like below</p>
  
  <pre><code>public List&lt;SOME RADIBUTTON ITEM&gt; radiobuttonlist {get;set;}
  </code></pre>
  
  <p><strong>Question:</strong></p>
  
  <p>Can we somehow display radiobuttonsame way we handle List of <strong>Dropdown Item</strong> . Can we somehow <strong>avoid hardcoding <code>"Referrer"</code> AND <code>"JobSeeker"</code> text</strong> in view file.</p>