Ext.NET 基础学习笔记06 (Ext.Net ComboBox用法)
1.ComboBox简单用法
<ext:ComboBox runat="server" ID="cmbUserList" DisplayField="Name" ValueField="ID">
<Store>
<ext:Store runat="server" ID="storeUserInfo">
<Model>
<ext:Model runat="server" ID="Model1" IDProperty="ID">
<Fields>
<ext:ModelField Name="ID" Type="Int"></ext:ModelField>
<ext:ModelField Name="Name" Type="String"></ext:ModelField>
<ext:ModelField Name="Gender" Type="String"></ext:ModelField>
<ext:ModelField Name="Age" Type="Int"></ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
</ext:ComboBox>
C#后台代码:
private void BindStore()
{
storeUserInfo.DataSource = UserInfo.GetData();
storeUserInfo.DataBind();
}
2.ComboBox分页
<ext:ComboBox runat="server" ID="cmbUserList" DisplayField="Name" ValueField="ID" PageSize="5">
3.ComboBox自定义显示
<ext:ComboBox runat="server" ID="cmbUserList" DisplayField="Name" ValueField="ID" PageSize="5">
<Store>
<ext:Store runat="server" ID="storeUserInfo">
<Model>
<ext:Model runat="server" ID="Model1" IDProperty="ID">
<Fields>
<ext:ModelField Name="ID" Type="Int"></ext:ModelField>
<ext:ModelField Name="Name" Type="String"></ext:ModelField>
<ext:ModelField Name="Gender" Type="String"></ext:ModelField>
<ext:ModelField Name="Age" Type="Int"></ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ListConfig>
<ItemTpl runat="server">
<Html>
<div>
<b>{Name}</b><br />
<span>年龄:{Age}</span>
<span>性别:{Gender}</span>
</div>
</Html>
</ItemTpl>
</ListConfig>
</ext:ComboBox>
效果: