This is a migrated thread and some comments may be shown as answers.

Radcombo autocomplete behave incorrectly while filtering the datalist.

1 Answer 16 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Himanshu
Top achievements
Rank 1
Himanshu asked on 22 Apr 2014, 10:47 AM
I am using Radcombo box inside a Telerik grid. The aspx code is below for this control:

                                <EditItemTemplate>
                                    <telerik:RadComboBox runat="server" TabIndex="4" ID="rdcmbgrdFesIssuingCompany" EnableLoadOnDemand="True"
                                        DataTextField="carriername" DataValueField="carriernameid" AutoPostBack="true"
                                    HighlightTemplatedItems="true" ShowDropDownOnTextboxClick="false"
                                    ItemsPerRequest="10" EnableVirtualScrolling="true"
                                     OnClientBlur= "ValidateCombinations"   OnItemsRequested="RdCmbIssuingCompany_ItemsRequested" 
                                        OnSelectedIndexChanged="RdCmbIssuingCompany_SelectedIndexChanged" Filter="StartsWith"
                                        OnClientItemsRequesting="OnClientItemsRequesting" OnClientItemsRequested="OnClientItemsRequested"
                                 OnClientFocus="OnClientFocus" OnClientDropDownOpening="OnClientDropDownOpening" MinFilterLength="0"
                                 ShowMoreResultsBox="false" NoWrap="true" DropDownAutoWidth="Enabled" OnClientDropDownOpened="OnRadDropDownOpened"
                                  OnClientSelectedIndexChanged="isTabActive" CausesValidation="true" CssClass="ovfl-hidden">
                                    </telerik:RadComboBox>
                                </EditItemTemplate>



OnItemRequsted below server side event has been called:

Protected Sub RdCmbIssuingCompany_ItemsRequested(ByVal sender As Object, _
                                                     ByVal e As  _
   RadComboBoxItemsRequestedEventArgs)
        
            Carriers.Tables(0).DefaultView.RowFilter = String.Empty
            Dim dvCarrier As DataView = Carriers.Tables(0).DefaultView()
            e.Text = e.Text.Replace("%", "[%]")
            e.Text = e.Text.Replace("'", "[']")
            'For Issuing         
            dvCarrier.RowFilter = "Issuing=1 and carriername like'" _
                                                     & e.Text & "%'"

            e.Message = dvCarrier.Count

            Dim comboBox As RadComboBox = DirectCast(sender, RadComboBox)
            Dim itemMessage As New RadComboBoxItem()


            ' Clear the default Item that has been re-created from ViewState at this point.
            comboBox.Items.Clear()
            dvCarrier.RowFilter = "Issuing=1"
            Dim endOffset As Integer = Math.Min(e.NumberOfItems + 10, dvCarrier.Count)
            comboBox.DataSource = dvCarrier
            comboBox.DataBind()
        
    End Sub


Now when user type text in this control then first it shows all datalist and a "loading" processing text and then it shows the filtered result to the user. For which i have attached the screen shot namely 1 (before server side event called) and 2 (after server side event called).

Now the expected result is that after typing the text in the control it must first filter the record then show the filtered data to the user directly. it should not show the unfiltered data to the user like in first screen shot.

So any idea/suggestion will be helpful.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 23 Apr 2014, 07:17 AM
Hi Himanshu,

Please have a look into the sample code snippet which works fine at my end. Let me know the version and browser you are using if it doesn't help.

ASPX:
<telerik:RadGrid ID="radgrdOrders" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="false" AutoGenerateEditColumn="true">
     <MasterTableView>
         <Columns>
             <telerik:GridBoundColumn DataField="OrderID" UniqueName="OrderID">
             </telerik:GridBoundColumn>
             <telerik:GridBoundColumn DataField="CustomerID" UniqueName="CustomerID">
             </telerik:GridBoundColumn>
             <telerik:GridTemplateColumn>
                 <EditItemTemplate>
                     <telerik:RadComboBox runat="server" TabIndex="4" ID="rdcmbgrdFesIssuingCompany" EnableLoadOnDemand="True" DataTextField="CompanyName" DataValueField="CompanyName" AutoPostBack="true" HighlightTemplatedItems="true" ShowDropDownOnTextboxClick="false" ItemsPerRequest="10" EnableVirtualScrolling="true" OnItemsRequested="RdCmbIssuingCompany_ItemsRequested" Filter="StartsWith" MinFilterLength="0" ShowMoreResultsBox="false" NoWrap="true" DropDownAutoWidth="Enabled" CausesValidation="true" CssClass="ovfl-hidden">
                     </telerik:RadComboBox>
                 </EditItemTemplate>
             </telerik:GridTemplateColumn>
         </Columns>
     </MasterTableView>
 </telerik:RadGrid>

VB:
Private Const ItemsPerRequest As Integer = 10
Protected Sub RdCmbIssuingCompany_ItemsRequested(sender As Object, e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs)
    Dim combo As RadComboBox = DirectCast(sender, RadComboBox)
    Dim data As DataTable = GetData()
    Dim itemOffset As Integer = e.NumberOfItems
    Dim endOffset As Integer = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count)
    e.EndOfItems = endOffset = data.Rows.Count
    For i As Integer = itemOffset To endOffset - 1
        combo.Items.Add(New RadComboBoxItem(data.Rows(i)("CompanyName").ToString(), data.Rows(i)("CompanyName").ToString()))
    Next
End Sub
Private Shared Function GetData() As DataTable
    Dim adapter As New SqlDataAdapter("SELECT * from Customers ", ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
    Dim data As New DataTable()
    adapter.Fill(data)
    Return data
End Function

Thanks,
Shinu.
Tags
Grid
Asked by
Himanshu
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or