A ComboBox is one of the most common controls, much like the Select control in HTML, but can be multi-selected, custom display format, paging, and so on. ComboBox usage
<Ext:ComboBoxRunat= "Server"Id= "Cmbuserlist"Displayfield= "Name"Valuefield= "ID" > <Store> <Ext:StoreRunat= "Server"Id= "Storeuserinfo" > <Model> <Ext:ModelId= "Model1"Runat= "Server"Idproperty= "ID" > <Fields> <Ext:ModelfieldName= "ID"Type= "Int" ></Ext:Modelfield> <Ext:ModelfieldName= "Name"Type= "String" ></Ext:Modelfield> <Ext:ModelfieldName= "Gender"Type= "String" ></Ext:Modelfield> <Ext:ModelfieldName= "Age"type= "Int" ></ext:modelfield> </ Fields> </ext:model> </model> </ext:Store> </></ Ext:combobox>
For a ComboBox, be sure to make Displayfield and Valuefield, then it contains a store, this store we are not unfamiliar, the previous few have been used.
Then we bind the data to the store when the page loads:
Bindstore () { UserInfo. GetData (); Storeuserinfo.databind ();}
The example of such a simple ComboBox is complete.
ComboBox Sub-page
When the amount of data is large, of course we want to be able to display the page, this feature ComboBox is supported.
First we need to page the store, the previous Ext.net study Note 08: The use of data and ext.net learning notes 09:ext.net in the usage of the store has been introduced, here is no longer discussed.
We then add the PageSize attribute of the paging to the definition of the ComboBox:
<ext:runatIDdisplayfieldvaluefieldPageSize= "5" >
Refresh our page again and you will find that the ComboBox is already supported for paging.
ComboBox Custom Display
The ComboBox supports customizing the display of each item through Xtemplate.
<Ext:ComboBoxRunat= "Server"Id= "Cmbuserlist"Displayfield= "Name"Valuefield= "ID"Matchfieldwidth= "false"PageSize= "5" > <Store>...</Store><Listconfig> <ItemtplRunat= "Server" > <Html> <Div> <B>{Name}</B><Br/> <Span>Ages: {Age}</span><br /> <> gender: { Gender}</span > </div > </itemtpl > </ ></ext:ComboBox< Span style= "color:blue;" >>
Ext.net Learning Note 10:ext.net ComboBox usage