+ -
当前位置:首页 → 问答吧 → 使用coolite的comboBox如何绑定sql Server数据

使用coolite的comboBox如何绑定sql Server数据

时间:2011-07-25

来源:互联网

先介绍一下sql server中的数据表
表名:班级
字段有三个:id,班级,班级编号
程序目的:在ComboBox列表框中显示班级表中的所有班级名称

我的绑定方法如下:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
  ConnectionString="<%$ ConnectionStrings:kyglConnectionString %>" SelectCommand="SELECT * FROM [班级表] order by id ASC">
</asp:SqlDataSource>

 <ext:Store ID="Store1" runat="server" >
  <Reader>
  <ext:JsonReader ReaderID="id">
  <Fields>
  <ext:RecordField Name="班级" Type="String" />  
  <ext:RecordField Name="班级编号" Type="String" /> 
  </Fields>
  </ext:JsonReader>
  </Reader>  
  </ext:Store>


<ext:ComboBox ID ="Cb1" StoreID ="Store1" runat ="server" DisplayField ="班级" ValueField ="班级编号" Mode="Remote" > 
</ext:ComboBox>


程序运行后,下拉列表中显示的全部都是“班级”这两个字……
是数据源的绑定出错了吗?

作者: woboxp   发布时间: 2011-07-25

帮顶啦。

作者: lsw645645645   发布时间: 2011-07-25

沉了,顶

作者: woboxp   发布时间: 2011-07-29