Problem with RadComboBox and SelectedValue

10 posts, 0 answers
  1. Derek
    Derek avatar
    104 posts
    Member since:
    Aug 2008

    Posted 28 Jan 2009 Link to this post

    Hi I have a RadComboBox wihich is populated by a datatable. This is fine. I map the id to an id in my main table using SelectedValue. I have a check in CurrentRowChanging event to see if there are pending changes and there always are, It's as if the combobox keeps setting the rowstate as modified, even though   the values haven't changed.  Any Ideas?
  2. Derek
    Derek avatar
    104 posts
    Member since:
    Aug 2008

    Posted 28 Jan 2009 Link to this post

    also, the combobox always stays on the first row even though I've set the SelectedValue
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Nick
    Admin
    Nick avatar
    767 posts

    Posted 30 Jan 2009 Link to this post

    Hi Derek,

    Thank you for your question. I cannot completely understand it though. Can you send us same code of what you have tried? I am looking forward to helping you further on that.

    Kind regards,
    Nick
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Jon
    Jon avatar
    813 posts
    Member since:
    Oct 2008

    Posted 09 Jun 2009 Link to this post

    Hi,

    I've got the same issue I think.

    I setup the combo box with a dataset and it all works.  However in my code when I set ComboBox.SelectedValue = y where y is one of the IDs in the dataset nothing gets set - the entry in the list when it appears on screen is simply set to the first item in the list.

    Do I have to set the selected value before the list gets bound to the dataset?

    Seems very weird to have a property and then not bother using it.

    Please could someone provide suggestions on selecting a value in a list programatically.

    Regards,

    Jon
     
  6. Jon
    Jon avatar
    813 posts
    Member since:
    Oct 2008

    Posted 09 Jun 2009 Link to this post

    This seems somewhat mad.

    I've worked out a work around to get the ID that should have been selected to be selected.  Luckily the SelectedText property does amazingly seem to work .

                        uxEditStatus.SuspendLayout()  
                        For Each item As Telerik.WinControls.UI.RadComboBoxItem In uxEditStatus.Items  
                            If item.Value.ToString() = IDTOMATCH Then uxEditStatus.SelectedText = item.Text  
                        Next 
                        uxEditStatus.ResumeLayout() 

    I'd love to know if the SelectedValue property is a somewhat odd 'feature' or if it is a bug...

    Regards,

    Jon

  7. Jon
    Jon avatar
    813 posts
    Member since:
    Oct 2008

    Posted 09 Jun 2009 Link to this post

    Or use the FindIndex sub below and pass it the combobox and ID to find.  Perhaps this functionality could be introduced into the combobox in a future release if the SelectedValue is by design?

    Public Sub FindIndex(ByRef combobox As Telerik.WinControls.UI.RadComboBox, ByVal indexValue As String)  
        combobox.SuspendLayout()  
        Dim i As Integer = 0  
        For Each item As Telerik.WinControls.UI.RadComboBoxItem In combobox.Items  
            If item.Value.ToString() = indexValue Then combobox.SelectedIndex = i  
            i += 1  
        Next 
        combobox.ResumeLayout()  
    End Sub 
  8. Nick
    Admin
    Nick avatar
    767 posts

    Posted 10 Jun 2009 Link to this post

    Hello Jon,

    Thank you for contacting us. I cannot reproduce the bug you reported using the following test code:

    private void Form2_Load(object sender, EventArgs e) 
     
                DataTable t = new DataTable(); 
                t.Columns.Add("A"typeof(string)); 
                t.Columns.Add("B"typeof(int)); 
                t.Rows.Add("text 1", 0); 
                t.Rows.Add("text 2", 1); 
                this.radComboBox1.DataSource = t; 
                this.radComboBox1.DisplayMember = "A"
                this.radComboBox1.ValueMember = "B"
                 
     
            
    private void radButton1_Click(object sender, EventArgs e) 
                this.radComboBox1.SelectedValue = 1; 

    However, we are very eager to help you further. Please double check your code, and if everything seems ok, send us a sample application or code snippet that reproduces the issue. In this regard, do you use the latest release - Q1 2009 SP1?

    All the best,
    Nick
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  9. Jon
    Jon avatar
    813 posts
    Member since:
    Oct 2008

    Posted 11 Jun 2009 Link to this post

    Hi Nick,

    Thanks for the reply.

    No I haven't installed SP1 yet, must have a try when I can't get a work around on any issues.

    I'm on a tight deadline at the moment so can't check into the issue at the moment and would create a new ticket with the application but it's got some merge replicated data controlled by mac addresses etc so will need to do some editing.

    When I've gotten past the deadline I'll come back to this as I'm sure that it's a bug somewhere (either my code or the Telerik code).

    Best Regards,

    Jon
  10. Nick
    Admin
    Nick avatar
    767 posts

    Posted 11 Jun 2009 Link to this post

    Hello Jon,

    Please take your time. We will be glad to check your sample application after your deadline. 

    All the best,
    Nick
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  11. Ankhaa
    Ankhaa avatar
    1 posts
    Member since:
    Jan 2011

    Posted 11 Dec 2013 Link to this post

    Hi, John

    I've a problem too. But i solved the problem. You have to check field type in your table. In my case i'm using MSSQL 2005, the table field type was numeric(18,0),  i changed it to Int type. The radDDL.selectedvalue=[number] has no problem.

    Anhaa
    Tricom
Back to Top
UI for WinForms is Visual Studio 2017 Ready