Search code examples
asp.net-mvckendo-uiknockout-mvc

KnockoutMVC with Kendo UI Complete for MVC can these be integrated server side


Server side wrapper for knockout.js http://knockoutmvc.com/ and Server side wrappers for Kendo UI for ASP.NET MVC http://demos.kendoui.com/web/grid/index.html can these be integrated server side anyone done it or have a working example.


Solution

  • Yes, you can integrate Kendo controls using server side wrappers.

    public static MvcHtmlString KEditorFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, string name, string value)
    {
        string ms = htmlHelper.Kendo().Editor()
                .Name(name)
                .Value(value)
                .ToHtmlString();
    
        return MvcHtmlString.Create(ms);
    }
    

    And in the view,

    @Html.KEditorFor(model=>model.EditorValue, "EditorValue", Model.EditorValue)
    

    I am not sure about KnockoutMVC, but you can do this for other Kendo controls, too.