发布:2014/11/10 13:24:12作者:管理员 来源:本站 浏览次数:1752
第一种 list第二种
<%= Html.DropDownList("dplProvince", ViewData["ProvinceList"] as List<SelectListItem>)%></center>
第三种
IList lists=SelectAll();
lists= ViewData["LIST"] ;
//界面上取值
<% for(int i=0;i< ViewData["LIST"].count;i++ ){%>
<%}%>
第四种
public ActionResult Index()
{
List<UserModel> list = new List<UserModel>();
list.Add(new UserModel { Age = 10, Password = "123", UerName = "小一" });
list.Add(new UserModel { Age = 20, Password = "456", UerName = "小二" });
list.Add(new UserModel { Age = 30, Password = "789", UerName = "小三" });
return View(list);
}
public class UserModel
{
public Age{get;set;}
public Password{get;set;}
public UerName{get;set;}
}
Index.cshtml
@Model UserModel
第五种
<%FuFangAdmin.Controllers.PhoneController p = new FuFangAdmin.Controllers.PhoneController();%>
<select id="NetworkType" name="NetworkType">
<% foreach (var dic in p.NetType)
{ %>
<option value="<%= Html.Encode(dic.Code)%>"><%= Html.Encode(dic.Text)%></option>
<%} %>
</select>
© Copyright 2014 - 2024 柏港建站平台 ejk5.com. 渝ICP备16000791号-4