Search on enter pressed?

2 posts, 0 answers
  1. Per
    Per avatar
    116 posts
    Member since:
    Jan 2008

    Posted 07 Aug 2009 Link to this post


    I think I have found a "bug".

    I have a multicolumndropdown on a form.
    The multicolumndropdown displays rows from a tabel with about 15000 rows in.
    I have implemented "on demand loading" by using the KeyPress event of the combobox control like this:







    Asc(e.KeyChar) = 13 Then


            Retailers = Retailer.LoadRetailersByReference1(cbCustomerSearchValue.Text)



            RetailerBindingSource.DataSource = Retailers


            If Retailers.Count > 1 Then




            ElseIf Retailers.Count = 1 Then





            End If
        End if
    End sub

    When the user selects a row, I load the information about the customer like this:
    Private Sub cbCustomerSearchValue_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbCustomerSearchValue.SelectedValueChanged



    If cbCustomerSearchValue.MultiColumnComboBoxElement.IsDroppedDown And cbCustomerSearchValue.SelectedItem IsNot Nothing Then




        LoadCustomer(DirectCast(DirectCast(cbCustomerSearchValue.SelectedItem, Telerik.WinControls.UI.GridViewDataRowInfo).DataBoundItem, DataAccessLayer.Retailer))



    End If



    End Sub




    If the search result in just one hit, I load that customer and display information about it.

    Here comes my problem:
    If the search resulted in more then one hit, I show the drop down list and the user can then select. (This is working)
    The problem here is that even though the text inside the drop down box is not the same as the displaymember text on the first row, the first row in the grid is still selected.

    Since the row is already selected, the selectedvaluechange event will not fire :(

    Is there a way to detect when the actual user clicks on a row (and not when the databind occurs)?

    Why is the first row selected when databinding occurs, can I disable this behavior?
    In a normal dropdown control no row is selected until the user made it choose.
    I think the multicolumndropdown should behave the same :)


  2. Jack
    Jack avatar
    2335 posts

    Posted 07 Aug 2009 Link to this post

    Hello Per,

    Regarding your questions:

    1. You can handle EditorControl.CellClick event. It fires when clicking in a grid cell.
    2. This is the desired behavior. You can't disable it. However, you can set EditorControl.CurrentRow property to null.

    If you continue to experience the issue, please send us your application and we will try to find a proper solution. Should you have any other questions, don't hesitate to ask.

    Best wishes,
    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.
  3. DevCraft R3 2016 release webinar banner
Back to Top