我使用LINQ從數據庫獲取來填充使用下面的代碼從下拉列表中選擇asp.net值:如何在包括人口下拉列表
XXXDataContext summary = new XXXDataContext();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
var binmy = (from bin in summary SUBPRODUCTs
order by bin.SUBID
select new { bin.SUBID, bin.SUBValue }
);
dropdownsummary.DataValueField = "SUBID";
dropdownsummary.DataTextField = "SUBValue";
dropdownsummary.DataSource = binmy;
DataBind();
}
}
在這裏,我想包括「所有'作爲默認值如何做到這一點?