1, directly assigned value
foreach in DS. tables[0]. Rows) // traversal gets two values { new Ext.Net.ListItem (); // Create one Ext.Net.ListItem object at a time Listitem.value = dr["ID"]. ToString (); = dr["Name"]. ToString (); DRPCOMBOX.ITEMS.ADD (ListItem);}
2, set the check, note that this method cannot be used in the store mode
Public voidSetlistvalue (ComboBox P_rg,stringp_value) { intnum =0; foreach(ListItem ListIteminch(statemanagedcollection<listitem>) P_rg. Items) {if(Listitem.value = =p_value) {P_rg. SelectedIndex=num; Extnet.addscript (string. Format ("{0}.setvalue (\ "{1}\");", (Object) P_rg. Clientid.tostring (), (Object) (P_value)) ; Break; } ++num; }}
3. Use store mode
" Name " ; this . Drpcombox.valuefield = id ; this . Drpcombox.storeid = "Storestudent ;
protected void Storestudent_refresh (object sender, Storerefreshdataeventargs e) { .. = ds. tables[0]; Storestudent.databind (); }
Set Current value
This . Drpcombox.setvalue (fenzuid); this. Drpcombox.text = V.leixingmingcheng;
Extjs.net Combox Value Assignment