第六节,建立的是查询页面,学习的所得,(1)更改调试初始页面,应该在app_start中的RouteConfig中修改;(2)验证的element;(3)后台方法重载貌似报错(4)
@Html.ActionLink("Create New", "Create")
@using (Html.BeginForm("SearchIndex","Movies",FormMethod.Get)){
<p>Genre: @Html.DropDownList("movieGenre", "All")
Title: @Html.TextBox("SearchString")
<input type="submit" value="Filter" /></p>
}
(5)GenreLst.AddRange(GenreQry.Distinct()); Distinct是只取唯一;(6)ViewBag.movieGenre=newSelectList(GenreLst);是绑定到页面的dropdownlist;(7)在controller中添加相应的页面时,最好先编辑controller中方法,在调试相对的页面