Thursday, April 26, 2012

ASP.NET MVC & jQuery UI autocomplete

http://blogs.msdn.com/b/ukadc/archive/2012/04/24/asp-net-mvc-amp-jquery-ui-autocomplete.aspx

    public static MvcHtmlString AutocompleteFor<TModel, TProperty>(this HtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, string actionName, string controllerName)
    {
        string autocompleteUrl = UrlHelper.GenerateUrl(null, actionName, controllerName,
                                                       null,
                                                       html.RouteCollection,
                                                       html.ViewContext.RequestContext,
                                                       includeImplicitMvcValues: true);
        return html.TextBoxFor(expression, new { data_autocomplete_url = autocompleteUrl});
    }

No comments:

Post a Comment