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

prevent the RadSearchBox from displaying items

1 Answer 70 Views
SearchBox
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 15 Jul 2014, 11:34 AM
Hello,

I am currently working on a project with a RadSearchBox .


VB.NET:
01.Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
02.    Dim User_Report As New DataTable
03.    Session("User_Report") = GenTreeData(User_Report)
04. 
05.    RadSearchBox1.DataTextField = "Name"
06.    RadSearchBox1.DataValueField = "ID"
07.    RadSearchBox1.DataSource = CType(Session("User_Report"), DataTable)
08.    RadSearchBox1.DataBind()
09. 
10.End Sub
11. 
12.Private Function GenTreeData(User_Report As DataTable) As DataTable
13. 
14.    User_Report.Columns.Add("Section")
15.    User_Report.Columns.Add("ID")
16.    User_Report.Columns.Add("Parent_ID")
17.    User_Report.Columns.Add("Description")
18.    User_Report.Columns.Add("Name")
19. 
20.    User_Report.Rows.Add("1", "101_1", "-1-1", "dedcrip", "xxxxxxx")
21.    User_Report.Rows.Add("1", "101_2", "-1-1", "dedcrip", "vvvvv")
22.    User_Report.Rows.Add("-1", "102_1", "-1-1", "dedcrip", "ccc")
23.    User_Report.Rows.Add("1", "-2-2", Nothing, Nothing, "ddd")
24.    User_Report.Rows.Add("1", "-3-3", "-1-1", Nothing, "ddd")
25.    User_Report.Rows.Add("1", "102_2", "-2-2", "dedcrip", "hhhhh")
26.    User_Report.Rows.Add("2", "101_3", "-2-2", "dedcrip", "lll")
27.    User_Report.Rows.Add("2", "-1-1", Nothing, Nothing, "ooooo")
28.    User_Report.Rows.Add("1", "101_4", "-3-3", "dedcrip", "zzzzz")
29.    User_Report.Rows.Add("1", "102_3", "-3-3", "dedcrip", "zzzzz")
30.    User_Report.Rows.Add("1", "102_4", "-3-3", "dedcrip", "zzzzz")
31.    User_Report.Rows.Add("1", "102_5", "-1-1", "dedcrip", "zzzzz")
32.    Return User_Report
33.End Function


ASPX:
<telerik:RadSearchBox ID="RadSearchBox1" runat="server" EmptyMessage="search" EnableAutoComplete="true">
                                <DropDownSettings Height="550px" Width="400px">
                                    <ItemTemplate>
                                        <div class="search-report-box">
                                            <span id="serach-report-name"><%# DataBinder.Eval(Container.DataItem, "Name")%></span><br />
                                            <span id="search-report-category"><%# DataBinder.Eval(Container.DataItem, "Description")%></span>
                                        </div>
                                    </ItemTemplate>
                                </DropDownSettings>
                            </telerik:RadSearchBox>

How can I prevent the RadSearchBox from displaying items
whose description is empty?

I’ll be glad for help,

Daniel.

1 Answer, 1 is accepted

Sort by
0
Accepted
Boyan Dimitrov
Telerik team
answered on 17 Jul 2014, 01:17 PM
Hello,

Thank you for contacting Telerik Support.

The only way to achieve such result is to filler  the RadSearchBox data source and populate the control with items that have a description value.

Please do not hesitate to contact us if you have any other questions.

Regards,
Boyan Dimitrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
SearchBox
Asked by
Daniel
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or