Tried to create this Extension method. Works except that the helper is rendering text, not the control to the View when the page renders:
I included using System.Web.Mvc.Html; at the top of my helper class that contains this extension method so that it would understand helper.RadioButton.
public static string WriteTestControlToScreen(this HtmlHelper helper)
{
StringBuilder fields = new StringBuilder();
fields.Append("<fieldset>");
fields.Append(" <div class='formLabel'><span class='requiredText'>*</span><label>Background Color</label></div>");
fields.Append(" <div class='formField'>" + helper.RadioButton("rbBackgroundColorWhite", 0, false) + "<label class='fieldInlineLabel' for=''>White</label></div>");
fields.Append(" <div class='formField'>" + helper.RadioButton("rbBackgroundColorWhite", 0) + "<label class='fieldInlineLabel' for=''>Black</label></div>");
fields.Append("</fieldset>");
return fields.ToString();
}
Output in the View then looks like this (notice it's not rendering a radiobutton but treating it as text instead):
*Background Color <%=Html.RadioButton('rbBackgroundColorWhite', 0, false)%>White <%=Html.RadioButton('rbBackgroundColorWhite', 0)%>Black