Article From:

1、Direct assignment

foreach (DataRow dr in ds.Tables[0].Rows)  //Traversing two values
    Ext.Net.ListItem listItem = new Ext.Net.ListItem();         //Create an object of Ext.Net.ListItem each time
    listItem.Value = dr["ID"].ToString();
    listItem.Text = dr["Name"].ToString();

2、Set the selected item. Note that this method can not be used in Store mode.

public void SetListValue(ComboBox p_rg, string p_value)
     int num = 0;
     foreach (ListItem listItem in (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));

3、Using Store

this.drpComBox.DisplayField = "Name";
this.drpComBox.ValueField = "ID";
this.drpComBOx.StoreID = "storeStudent";
 protected void storeStudent_Refresh(object sender, StoreRefreshDataEventArgs e)
     storeStudent.DataSource = ds.Tables[0];


 set currency

this.drpComBox.Text = v.Name


Link of this Article: Combox assignment

Leave a Reply

Your email address will not be published. Required fields are marked *