title: How can I generate the html code for a drop-down inside a controller in MVC?
body: <p>I have a javascript function, part of which has a section that accepts HTML code. Right now, I have the following line in that javascript code:</p>
  <pre><code>html: `@Html.Action(&quot;Position&quot;,&quot;Admin&quot;)`
  </code></pre>
  <p>My issue is that my Position view has only one line in it:</p>
  <pre><code>@Html.DropDownList(&quot;PositionId&quot;,null,htmlAttributes: new {@class = &quot;form-control&quot;})
  </code></pre>
  <p>However, I feel like it's a waste to have an entire View created with just one line. I'm only using the view because I need to generate the HTML for the DropDownList via Razor to pass to my function.</p>
  <p>How can I generate the resulting HTML code in my controller without having to create a view?</p>