I created a custom control in my ASP MVC application. Here is the Html Helper for the button
public static MvcHtmlString EditButton(this HtmlHelper html, string action,
string controller, bool state)
{
var url = new UrlHelper(html.ViewContext.RequestContext);
//génrer le tag <a>
var builder = new TagBuilder("a");
//ajouter les différents attributs du tag
builder.MergeAttribute("href", url.Action(action, controller));
builder.MergeAttribute("alt", "edit");
builder.MergeAttribute("title", "Edit");
if (state)
{
builder.AddCssClass("edit_active");
}
else
{
builder.AddCssClass("edit_inactive");
}
string anchorHtml = builder.ToString(TagRenderMode.Normal);
return MvcHtmlString.Create(anchorHtml);
}
I want to add a parameter for the color of the button. How can I do that ?
Thanks.