日期:2014-05-20  浏览次数:20909 次

LINQ怎样绑定DropDownList
如题

------解决方案--------------------
C# code

var hospitals = from h in db.B_Hospital
                                where h.IsDel == 1
                                orderby h.HospitalName
                                select h;
 ddlHospital.DataSource = hospitals;
                ddlHospital.DataTextField = "HospitalName";
                ddlHospital.DataValueField = "ID";
                ddlHospital.DataBind();