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

Force users to choose from Dropdown

3 Answers 119 Views
SearchBox
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 2
Markus asked on 27 Jun 2013, 03:48 PM
Good day to all 

I have the following code: 

telerik:RadSearchBox ID="RadSearchBox1" runat="server" Width="250px" Skin="MetroTouch" DataSourceID="OpenAccessLinqDataSource1" CssClass="" DataTextField="user_firmaname"
    DataValueField="user_id" Culture="de-DE" onsearch="RadSearchBox1_Search" ShowSearchButton="False">
 <DropDownSettings Height="400" Width="670" >
    <HeaderTemplate>
                    <ul>
                        <li class="col1">Firma</li>
                        <li class="col2">Ort</li>
                       
                    </ul>
                </HeaderTemplate>
                <ItemTemplate>
                    <ul>
                        <li class="col1">
                            <%# DataBinder.Eval(Container.DataItem, "user_firmaname") %></li>
                        <li class="col2">
                            <%# DataBinder.Eval(Container.DataItem, "user_ort") %></li>
                     
                    </ul>
                </ItemTemplate>
                  </DropDownSettings>
</telerik:RadSearchBox>


protected void RadSearchBox1_Search(object sender, SearchBoxEventArgs e)
        {
            if (e.Text  != null)
            {
                string firmenname = e.Text;
                firmenname = firmenname.Replace("+", "und");
                Response.Redirect("/firmen/" + e.Value + "/" + firmenname);
            }
            else
            {
                RadSearchBox1.EmptyMessage = "keine Firma gefunden";
            }
        }

The problem is that if the client does not pick from the dropdown but simply hits enter e.value of course is not what I am looking for.

So I need a way to disable enter and have the client force to pick from dropdown.

You can try it here: http://zuol.ch.mserver4.arvixevps.com/firmen/ left side 

Markus


3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 01 Jul 2013, 08:10 AM
Hi Markus,

 
This is a known issue in RadSearchBox that is currently not returning any value because it is not known which one to return when there a re many items in the drop-down. Currently we are researching the scenario and  from the upcoming service pack we plan to add a property that will give you the chance to select the first item from the drop-down on a click of the search button.

Hope this information will be helpful.

Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Dehanys
Top achievements
Rank 1
answered on 13 Oct 2016, 07:45 PM
Is there any solution to this issue yet?
0
Plamen
Telerik team
answered on 14 Oct 2016, 05:40 AM
Hello,

You can set the HighlightFirstMatch property to true that is available in the control in the latest versions of the controls.

Regards,
Plamen
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
SearchBox
Asked by
Markus
Top achievements
Rank 2
Answers by
Plamen
Telerik team
Dehanys
Top achievements
Rank 1
Share this question
or