2

I'm trying to convert an app that I had previously written in ASP.NET Web Forms to MVC and am stuck on the problem of implementing an autocompleting combobox. Previously, I had used Telerik's RadComboBox, but I'm not sure how to make this work in MVC or if it even can be made to work. Here's the markup code I was using:

<telerik:RadComboBox ID="Brand" runat="server" Width="250px" EmptyMessage="Choose a brand" EnableLoadOnDemand="true" OnItemsRequested="Brand_OnItemsRequested" />

And the code-behind:

protected void Brand_OnItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
{
  foreach (BrandCode b in _repository.GetBrandCode(e.Text).OrderBy(b => b.BrandName).Take(10))
  {
    Brand.Items.Add(new Telerik.Web.UI.RadComboBoxItem(b.BrandName, b.BrandCode1));
  }

  Brand.DataBind();
}

Any ideas appreciated.

1 Answer 1

5

We do this at work by simply populating a drop down list (or combobox, whichever tickles your fancy), and then using jquery's autocomplete by doing something like $('#myddl').autocomplete();

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.