Reputation: 32818
I would like to execute the following from within a razor view
@Select.Topics(@Model.DataSource, @Model.ExamID, @Model.TopicID)
The code works fine but when it returns everything is encoded:
<select id="TopicID">
<option value='00'>All Topics</option><option value='01' selected='selected'
</select>
I cannot change my C# code as it is used in other places. How can I make the view accept exactly what I need? I seem to remember something about RenderAction would that be an option?
Upvotes: 2
Views: 213
Reputation: 16368
The output is encoded to prevent html code injection. To bypass the encoding use @Html.Raw("[html string]") helper, Btw you shouldn't store the options as html tags. Store only the values and then use @Html.DropDownList helper
Upvotes: 4