Coolite ComboBox数据绑定

ContractedBlock.gif ExpandedBlockStart.gif aspx代码:
 
   
1      < div >
2 < ext:Store ID ="Store1" runat ="server" AutoLoad ="true" >
3 < Reader >
4 < ext:jsonreader readerid ="employee_no" >
5 <% --< ext:ArrayReader >-- %>
6 < Fields >
7 < ext:RecordField Name ="employee_no" >
8 </ ext:RecordField >
9 < ext:RecordField Name ="employee_display_name" >
10 </ ext:RecordField >
11 </ Fields >
12 <% --</ ext:ArrayReader >-- %>
13 </ ext:JsonReader >
14 </ Reader >
15 </ ext:Store >
16 < ext:ComboBox ID ="ComboBox1" runat ="server" StoreID ="Store1" Width ="250" Editable ="false"
17 TypeAhead ="true" Mode ="Local" ForceSelection ="true" TriggerAction ="All" SelectOnFocus ="true"
18 EmptyText ="Please choose..." >
19 </ ext:ComboBox >
20 </ div >
21 < ext:ScriptManager ID ="ScriptManager1" runat ="server" >
22 </ ext:ScriptManager >

 CS代码:

 
  
1 foreach (DataRow r in ds.Tables[ 0 ].Rows)
2 {
3 ComboBox1.Items.Add( new Coolite.Ext.Web.ListItem(r[ 1 ].ToString(), r[ 0 ].ToString()));
4 }

用这种方式时,页面使用jsonreaderArrayReader均可;

 

或者以下方式绑定:

ContractedBlock.gif ExpandedBlockStart.gif cs代码:
 
   
1       Store1.DataSource = ds.Tables[ 0 ];
2 Store1.DataBind();
3 ComboBox1.ValueField = " employee_no " ;
4 ComboBox1.DisplayField = " employee_display_name " ;
5 // ComboBox1.StoreID = Store1.ClientID;
6   ComboBox1.DataBind();

 用这种方式时,页面使用jsonreader;StoreID 如果页面指定,则此处可不加ComboBox1.StoreID = Store1.ClientID;

转载于:https://www.cnblogs.com/pfs1314/archive/2010/05/07/1729944.html

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值