DropDownList
1. 绑定数据
private void Initialization()
{
this.dropSpecialty.DataSource = sbn.Selete("select [id], specialtyname from specialty");
this.dropSpecialty.DataTextField = "specialtyname";
this.dropSpecialty.DataValueField = "ID";
&nbs
本文介绍了如何在ASP.NET中使用DropDownList控件进行数据绑定。首先展示如何从数据库中选择专业信息并绑定到控件,利用DataTextField和DataValueField属性分别设置显示字段和值字段。接着在编辑模式下,通过SelectedValue属性设置当前班级的专业ID。最后提到,为获取DropDownList的选中值,需设置AppendDataBoundItems属性为True。
DropDownList
1. 绑定数据
private void Initialization()
{
this.dropSpecialty.DataSource = sbn.Selete("select [id], specialtyname from specialty");
this.dropSpecialty.DataTextField = "specialtyname";
this.dropSpecialty.DataValueField = "ID";
&nbs

被折叠的 条评论
为什么被折叠?