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

RadSearchBox filter - Dinstinct Values only

1 Answer 101 Views
SearchBox
This is a migrated thread and some comments may be shown as answers.
Mashrukh
Top achievements
Rank 1
Mashrukh asked on 24 Nov 2015, 08:21 PM

Hello,

 

I am working with the rad search box, and my code on the view page looks like:

<telerik:RadSearchBox ID="rsbCode" runat="server"
                          EmptyMessage="Search Options" Skin="Office2010Silver"
                          Width="460" DropDownSettings-Height="300" 
                          DataSourceID="SqlDataSource1" 
                          DataTextField="Code" 
                          DataValueField="Code" >
    </telerik:RadSearchBox>

 The data source I am pulling from has a list of employees each with a code number. Each employee has a code number, but different employees can have the same code number. This causes an issues with the search box, as the filter will show multiple values. 

For example, if 3 different employees has the code number 2100. As I type '21' on the RadSearchBox, the 2100 will appear 3 times. How can I make the filter only show distinct values, such that 2100 will only appear once?

 

Thanks very much for your help

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 27 Nov 2015, 04:03 PM
Hello Mashrukh,

I would suggest you to subscribe for the OnDataSourceSelect event of the control, which is design to be used in exactly such scenarios, where you need to alter the query to your database (with Distinct for example).

Please refer to the following documentation article, demonstrating the usage of the event:

http://docs.telerik.com/devtools/aspnet-ajax/controls/autocompletebox/server-side-programming/events/ondatasourceselect


Regards,
Nencho
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
SearchBox
Asked by
Mashrukh
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or