RadComboBox SelectedItem not working

7 posts, 0 answers
  1. Muhammad Irfan
    Muhammad Irfan avatar
    13 posts
    Member since:
    Oct 2007

    Posted 31 Jan 2011 Link to this post

    Hi Telerik Support,

    I am having a problem with RadComboBox. I am not able to select the first item of RadComboBox programmatically. I have instantiated  a RadComboBox with 2 columns. I am giving user the ability to filter combo box based upon items present either in column 1 or 2. The search criteria may not necessarily appear in the beginning of the dropdown items, it may appear anywhere in the text. For example I have a dropdown with 2 columns with first column having "Project Engineer" and second "VAC-1001". My user types "1001" as search criteria and system brings one record, but that record (RadComboBoxItem) is not being selected.

    I have set MarkFirstMatch property to "true". I tried setting SelectedItem to its text but getting below error:

    "Property 'SelectedItem' is 'ReadOnly'."

    I also tried using SelectedIndex, but that is also not working. Please help me select the first item. I am using 2010.2.713.35 verion of Telerik.Web.UI and Telerik.Web.Design.

    If RadComboBox.Items.Count > 0 Then
     RadComboVacancyList.SelectedIndex = 0
    End
    If

    Many thanks.
  2. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 02 Feb 2011 Link to this post

    Hello Muhammad Irfan,

    I am afraid that we will need more details about your implementation.
    Could you please send us a simplified runnable page where we will be able to observe the issue?
    Do you use Load On Demand?
    I was not able to understand what you mean by “… but that record (RadComboBoxItem) is not being selected.”?  Do you want the item to be selected or you expect it to be highlighted?

    All the best,
    Kalina
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Muhammad Irfan
    Muhammad Irfan avatar
    13 posts
    Member since:
    Oct 2007

    Posted 14 Jun 2011 Link to this post

    I sorted that out myself. 

    Thanks
  5. Nils C.
    Nils C. avatar
    41 posts
    Member since:
    Oct 2009

    Posted 16 Dec 2011 Link to this post

    Hi Muhammad,
    would you mind telling us how? We've got the same issue.

    Best
  6. Karlo
    Karlo avatar
    5 posts
    Member since:
    Oct 2011

    Posted 15 Jan 2012 Link to this post

    Had the same experience. RadComboBox SelectedItem Property is Read-Only (v. 2011 q3 SP1). My solution was

    ...
    radComboBox.SelectedIndex = radComboBox.FindItemIndexByText(dataItemValue);
    ...
  7. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 28 Feb 2013 Link to this post

    So that above works I guess.  Is this the best way to do it?  I've been doing WPF/Silverlight for the past 3 years, what pain that this doesn't work easy
  8. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 04 Mar 2013 Link to this post

    Hello,

    Indeed the provided solution works fine and selects the specific item that has  "textValue" value as Text property.
    //code behind
    RadComboBox1.SelectedIndex = RadComboBox1.FindItemIndexByText("textValue");

    Alternative way of achieving that functionality would be to iterate through all items and set that specific item Selected property to true.
    //code behind
    for (int i = 0; i < RadComboBox1.Items.Count; i++)
           {
               if (i == 2)
               {
                   RadComboBox1.Items[i].Selected = true;
               }
           }


    All the best,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017