How To Declare CheckBox Different Ways In MVC

In this article i explain you how to declare checkbox different ways in mvc
We have diffrent overloaded versions in mvc for declaring checkbox

1st Form :-
    @Html.CheckBox("CheckBox1")
2nd Form :-
    @Html.CheckBox("CheckBox1",true)
3rd Form :-
    @Html.CheckBox("CheckBox1", new { id="chk1",value="option1"})
4rh Form :-
    @Html.CheckBox("CheckBox1", new Dictionary<string, object>() { { "id","chk1"} ,{"value","option"}})
5th Form :-
    @Html.CheckBox("CheckBox1", true, new { id="chk1",value="option1"})
6th Form :-
    @Html.CheckBox("CheckBox1", true, new Dictionary<string, object>() { {"id","chk1" },{"value","option1"} })

No comments:

Post a Comment