mercredi 3 juin 2015

Not showing Checkbox in mvc

Hi I'm trying to run a checkbox field in mvc base on video tutorial that i've watch https://www.youtube.com/watch?v=4KeoOPWshmw&list=PL6n9fhu94yhVm6S8I2xd6nYz2ZORd7X2v&index=38, I follow it carefully. but there is a problem the checkbox is not showing in my browser.

it shows only a text 12345 and a button submit.

Index.cshtml

@model IEnumerable<MvcCheckBox.Models.City>

@{
    ViewBag.Title = "Home";
}

<h2>Index</h2>
@using (Html.BeginForm())
{ 
    @Html.EditorForModel()
    <br />
    <input type="submit" value="Submit" />
}


City.cshtml

@model MvcCheckBox.Models.City

@Html.HiddenFor(x => x.ID)
@Html.HiddenFor(x => x.Name)

@Html.CheckBoxFor(x => x.IsSelected)
@Html.DisplayFor(x => x.Name)




Aucun commentaire:

Enregistrer un commentaire