DropDownList原来绑定一个ObjecDataSource(从数据库中查出所有值:例如有数学,语文,英语),
例如:
在页面上有数学,语文,英语三个链接,我点击 “语文”,把这个“语文”绑定到DropDownList,设为默认值。用this.ddlBranchName.Items.FindByValue(“语文”).Selected = true; 不可以,
那位大侠帮帮忙,非常感谢
例如:
在页面上有数学,语文,英语三个链接,我点击 “语文”,把这个“语文”绑定到DropDownList,设为默认值。用this.ddlBranchName.Items.FindByValue(“语文”).Selected = true; 不可以,
那位大侠帮帮忙,非常感谢
{
ddlst.datasource=datatable;
ddlst.databind();
ddlst.selectindex=ddlst.items.indexof(ddlst.items.findbyvalue("值"));
//ddlst.selectindex=ddlst.items.indexof(ddlst.items.findbyText("文本"));
}大体是这个样子了!