【发布时间】:2011-10-24 20:44:07
【问题描述】:
我正在做一个项目,我有一个 OdbcDataReader,它从查询中读取数据并使用查询中的项目填充 DropDownList。当我运行 Web 应用程序并在列表中选择不同的项目时,无论是否启用回发、启用智能分页或 EnableViewState
protected void populateGrid(OdbcDataReader reader)
{
ClientDropDownList.DataSource = reader;
ClientDropDownList.DataTextField = "company";
ClientDropDownList.DataBind();
}
【问题讨论】:
-
请提供更多信息。您使用哪个页面生命周期阶段来调用此 populateGrid(...) 方法?如果你想在后面的代码中获取选中的值,你用什么方法来做到这一点?
-
您还应该设置DataValueField。