VB.NET - how to set value for RADCombo box - Asked By Kaleem Khan on 22-Dec-09 11:22 PM

Dim Levels As String() = {"JANUARY", _

"FEBRUARY", "MARCH", _

"APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"}

cmbMonth.DataSource = Levels

cmbMonth.DataBind()


how to set value for RADCombo box

Re - Huggy Bear replied to Kaleem Khan on 23-Dec-09 12:38 AM

To set the value for RAD combo box you can use the SelectedValue property.

cmdMonth.SelectedValue = "MARCH";

Since you data source is a 1 column string array, Both the text and value would be the same value.

re - Web Star replied to Kaleem Khan on 23-Dec-09 12:40 AM

u simply bind array or arraylist to radcombobox contorl

private void BindToArray(RadComboBox combo)
{
 
string[] itemsList = { "One", "Two", "Three" };
 combo.DataSource = itemsList;
 combo.DataBind();
}
private void BindToArrayList(RadComboBox combo)
{
 ArrayList itemsList =
new ArrayList();
 itemsList.Add(
"One");
 itemsList.Add(
"Two");
 itemsList.Add(
"Three");
 combo.DataSource = itemsList;
 combo.DataBind();
}

http://www.telerik.com/help/aspnet-ajax/combo_databindingarray.html


re - Web Star replied to Kaleem Khan on 23-Dec-09 12:43 AM

if u wnat ot set particular value after binding then ignore my first post u can select vlaue as follows in javascript

<script language="javascript" type="text/javascript">     
function Button2_onclick()     
{     
   var combo = <%=radcontorlid.ClientID %>;     
   var item = combo.FindItemByText("text");     
   if(item)     
   {     
      item.Select();     
   }     
}     
</script>