This question is locked. New answers and comments are not allowed.
To reduce the code I have in views I try to create Helpers that do the bulk of the viewing work for me.
The following code (in razor) occurs very often:
And I would like to create an HTML helper that will simply call this whole function block and render it to the page.
I have created a helper with a static method and included the Telerik.Web.Mvc.UI namespace.
However, when I try to use this namespace from code I'm having a hard time creating even a simple grid. The Grid class in the namespace is generic (as opposed to the one used in views) and requires a viewContext and other parameters that I cannot instantiate. I get the feeling I'm not using the correct approach here.
The following code (in razor) occurs very often:
@{ Html.Telerik()
.Grid(Model)
.Name("Grid")
.Columns(columns => {
columns.Template(o => o.Name);
columns.Template(o => @Html.ActionLink("Edit", "Edit", new { id = o.Id }));
columns.Template(o => @Html.ActionLink("Delete", "Delete", new { id = o.Id }));
})
.Render();
}
And I would like to create an HTML helper that will simply call this whole function block and render it to the page.
I have created a helper with a static method and included the Telerik.Web.Mvc.UI namespace.
However, when I try to use this namespace from code I'm having a hard time creating even a simple grid. The Grid class in the namespace is generic (as opposed to the one used in views) and requires a viewContext and other parameters that I cannot instantiate. I get the feeling I'm not using the correct approach here.