Noam Igor Veronin
Noam Igor Veronin

Reputation: 183

How to add css for CheckBoxFor on MVC

How can I add Css style for checkBoxFor on MVC?

This is My View

               @Html.CheckBoxFor(m => 
               Model.CategoryList.Categories[i].IsCheck)
               @Model.CategoryList.Categories[i].SelectedCategoryName;


                @Html.HiddenFor(m => 
                Model.CategoryList.Categories[i].SelectedCategoryID);
                @Html.HiddenFor(m => Model.CategoryList.Categories[i].SelectedCategoryName);

Upvotes: 2

Views: 7803

Answers (1)

José De León
José De León

Reputation: 125

@Html.CheckBoxFor(m => Model.CategoryList.Categories[i].IsCheck, new { @class = "myclass" })

Or you can also add inline CSS but i recommend using the first approach.

@Html.CheckBoxFor(m => Model.CategoryList.Categories[i].IsCheck, new { style="width:100px;height:25px" })

Upvotes: 5

Related Questions