Setting 'Checked' value in RadComboBox

2 posts, 0 answers
  1. Rich
    Rich avatar
    31 posts
    Member since:
    May 2011

    Posted 20 Jun 2011 Link to this post

    I have a databound ComboBox that the application user needs to be able to 'check'.  What need to do is to show the user which entries have already been 'checked', that is I need to be able to programmatically set the checked property of the items in the combobox.  I can id the items to be checked, I just need the code to actually "check" the item.

    Here is my code so far:

    If item.IsInEditMode Then

    Dim indx As Integer = ctlUserCombo.FindItemIndexByText("Test, Sabo")

    Dim cmbo As RadComboBox = CType(item.FindControl("ctlUserCombo"), RadComboBox)

    Dim cbox As RadComboBoxItem = CType(cmbo.Items(indx), RadComboBoxItem)

    cmbo.Items(indx).Enabled = False

    So I am able to change the Enabled property to False...what I need to be able to do is set the combobox to "Checked".  However the RadComboBoxItem does not have a 'checked' property.  Anyone know how to get the combo box to show checked = true for individual items in the combobox? 


  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 21 Jun 2011 Link to this post

    Hello Rich,

    You can use findControl() method to access the CheckBox. Here is the sample code.
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
      int indx = ctlUserCombo.FindItemIndexByText("Test, Sabo");
      RadComboBox cmbo = (RadComboBox)item.FindControl("ctlUserCombo");
      RadComboBoxItem cbox = (RadComboBoxItem)cmbo.Items(indx);
      CheckBox chk= (CheckBox)item.FindControl("CheckBox1");
      chk.Checked = true;

Back to Top