prevent the RadSearchBox from displaying items

2 posts, 1 answers
  1. Daniel
    Daniel avatar
    159 posts
    Member since:
    Feb 2014

    Posted 15 Jul 2014 Link to this post

    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.
  2. Answer
    Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 17 Jul 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top