Coolite学习笔记----ComBoBox绑定数据源
2011-05-22 20:32
316 查看
绑定方式1:
private void BindCombox2(ComboBox cb)
{
DataTable dt = new Bll.CoolingWater().GetAllCoolingWater();
foreach (DataRow r in dt.Rows)
{
cb.Items.Add(new Coolite.Ext.Web.ListItem(r[1].ToString(),r[0].ToString()));
}
}
绑定方式2:
<ext:Store ID="StoreInfo" runat="server" AutoLoad="true"
OnRefreshData="InitComboBox">
<Reader>
<ext:JsonReader ReaderID="COOLING_WATER_ID">
<Fields>
<ext:RecordField Name="COOLING_WATER_ID">
</ext:RecordField>
<ext:RecordField Name="COOLING_WATER_NAME">
</ext:RecordField>
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:ComboBox ID="Cbo" runat="server" AllowBlank="true"
StoreID="StoreInfo" ValueField="COOLING_WATER_ID"
DisplayField="COOLING_WATER_NAME" TriggerAction="All" EmptyText="-请选择-" ReadOnly="true" Width="100px">
</ext:ComboBox>
public void InitComboBox(object sender, StoreRefreshDataEventArgs e)
{
Bll.CoolingWater bo = new Bll.CoolingWater();
StoreInfo.DataSource = bo.GetAllCoolingWater();
StoreInfo.DataBind();
}
private void BindCombox2(ComboBox cb)
{
DataTable dt = new Bll.CoolingWater().GetAllCoolingWater();
foreach (DataRow r in dt.Rows)
{
cb.Items.Add(new Coolite.Ext.Web.ListItem(r[1].ToString(),r[0].ToString()));
}
}
绑定方式2:
<ext:Store ID="StoreInfo" runat="server" AutoLoad="true"
OnRefreshData="InitComboBox">
<Reader>
<ext:JsonReader ReaderID="COOLING_WATER_ID">
<Fields>
<ext:RecordField Name="COOLING_WATER_ID">
</ext:RecordField>
<ext:RecordField Name="COOLING_WATER_NAME">
</ext:RecordField>
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:ComboBox ID="Cbo" runat="server" AllowBlank="true"
StoreID="StoreInfo" ValueField="COOLING_WATER_ID"
DisplayField="COOLING_WATER_NAME" TriggerAction="All" EmptyText="-请选择-" ReadOnly="true" Width="100px">
</ext:ComboBox>
public void InitComboBox(object sender, StoreRefreshDataEventArgs e)
{
Bll.CoolingWater bo = new Bll.CoolingWater();
StoreInfo.DataSource = bo.GetAllCoolingWater();
StoreInfo.DataBind();
}
相关文章推荐
- WPF的ComboBox绑定[个人学习笔记](不成熟)
- WPF学习笔记——ListBox用ItemsSource绑定数据源
- WPF学习笔记:ComboBox的数据绑定
- WPF学习笔记:ComboBox的数据绑定
- Android开发学习笔记:为动态添加的Spinner控件绑定数据源以及监听事件
- Coolite Toolkit学习笔记三:基本控件之Button、TextField、DataField、ComboBox 推荐
- coolite1.0 学习笔记(二) --Combobox 获得焦点自动展开 功能实现
- ASP.NET 3.5核心编程学习笔记(17):基于数据源的数据绑定
- WPF and Silverlight 学习笔记(二十三):绑定集合数据源
- Java学习笔记——可视化Swing中JTable控件绑定SQL数据源的两种方法
- WPF and Silverlight 学习笔记(二十三):绑定集合数据源
- WPF学习笔记——ListBox用ItemsSource绑定数据源
- WPF学习笔记——ListBox用ItemsSource绑定数据源
- vue.js学习笔记之属性绑定 v-bind
- ASP.NET学习笔记2--自己写代码绑定Gridview
- 整理一下当年的学习笔记之:SpringMVC的各种参数绑定方式
- 关于静态绑定与动态绑定的辨别笔记----C++学习之路
- WCF学习笔记--WCF提供的9个标准绑定
- Extjs学习笔记(-):ComboBox联动
- DevExpress:下拉框绑定数据源 (ComboBoxEdit,LookUpEdit)