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

How to extend Kendo UI MVC controls on the client side?

1 Answer 91 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
NerdBrick
Top achievements
Rank 1
NerdBrick asked on 05 Oct 2017, 04:38 PM
I can follow the help topic on how to extend the Kendo UI widgets here, but I'm looking for how to do a similar thing for MVC Controls. 

If an MVC control has been initialized and rendered into the page's partial view, how can I tell the MVC control to use my Kendo Widget which was inherited from the original control?

Thank you

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 09 Oct 2017, 10:14 AM
Hello Brick,

If you need to create a custom HtmlHelper that can accept additional configuration options, then you should use the following approach:
public static class MyHtmlHelperExtensions
{
  public static Kendo.Mvc.UI.Fluent.GridBuilder<T> MyGrid<T>(this HtmlHelper helper, string name)
    where T : class
  {
    return helper.Kendo().Grid<T>()
      .Name(name)
  // More options
  }
}

Then, the extended widget can be initialized in the view as follows:
@(Html.MyGrid<ProductViewModel>("GridCustom")
    ...
)

Additional information about the different Builders can be found in the Kendo UI for ASP.NET MVC Documentation.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
General Discussions
Asked by
NerdBrick
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or