下午有做了练习《Html.DropDownListFor练习》http://www.cnblogs.com/insus/p/3382575.html 在实现过程中,需要创建一个List<SelectListItem>数据集,如下

或者:

刚才生新温习这个练习,发觉到其实我们不必写这些数据集,直接使用已经存在FruitCategoryEntity.cs类的IEnumerable<FruitCategory> GetAllFruitCategory()数据集也行。

在视图中的Razor语法:

其实Insus.NET所做这些练习,均是与数据库相连接,也是将来在专案中最接近的实现。