Extjs.net Combox Value Assignment

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.