AutoComplete Data-Bind html attributes

2 posts, 0 answers
  1. Gregor
    Gregor avatar
    17 posts
    Member since:
    May 2012

    Posted 14 Sep 2012 Link to this post

    Id like to extend to the AutoComplete helper to pass in a data-bding html 5 attribute, I have the following:-

              .DataSource(source =>
                      source.Read(read =>
                              read.Action("ProductSuggestions", "Search")

    I want to be able to add a new HtmlAttrobute something like this:-

    .HtmlAttributes(new[] { "data-bind='executeOnEnter: products'" })

    So that I can use a knockoutJS custom binding - can anyone help me with this?
  2. kashyapa
    kashyapa avatar
    7 posts
    Member since:
    Jan 2011

    Posted 16 Oct 2012 Link to this post

    Here's what you need to do to achieve that :

    @(Html.Kendo().AutoCompleteFor(model => model.Person.State.Abbreviation)
                         .HtmlAttributes(new { data_bind="executeOnEnter:products" })

Back to Top