2

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);
1
  • 1
    @Html.CheckBoxFor(m => Model.CategoryList.Categories[i].IsCheck, new { @class = "yourcss" }) Commented Oct 4, 2017 at 21:54

1 Answer 1

5
@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" })
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.