I have tried several things with no success. The most I can is the helper to be called BUT instead of the value being passed it passes #: Style # as string instead of its value
without calling the helper i can display all values
My question is: how do I call a helper that has parameters inside a ClientTemplate?
Helper (MyHelpers.cshtml on app_code folder)
@helper ProductDisplay(string Style, string DefaultColor, string Name)
{
<div class="prodName" data-id="@(Style + "-" + DefaultColor)">@Name</div>
string img = "http://url/image/" + Style + DefaultColor + "_1?$ereredq$&bregc=0,0,0,0";
<text><img src="@img" /></text>
}
Grid
============================================
@(Html.Kendo().Grid<TestProject.Models.ProductModel.ProductInformation>()
.Name("webGrid").AutoBind(true).Scrollable(scr=>scr.Height(430))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetProducts", "Home")
)
.ServerOperation(false)
)
.Columns(columns =>
{
columns.Template(@<text></text>).ClientTemplate(@MyHelpers.ProductDetail("#: Style #, #: DefaultColor #, #: Name #").ToHtmlString());
})
.Pageable()
.Scrollable()
)
without calling the helper i can display all values
My question is: how do I call a helper that has parameters inside a ClientTemplate?
Helper (MyHelpers.cshtml on app_code folder)
@helper ProductDisplay(string Style, string DefaultColor, string Name)
{
<div class="prodName" data-id="@(Style + "-" + DefaultColor)">@Name</div>
string img = "http://url/image/" + Style + DefaultColor + "_1?$ereredq$&bregc=0,0,0,0";
<text><img src="@img" /></text>
}
Grid
============================================
@(Html.Kendo().Grid<TestProject.Models.ProductModel.ProductInformation>()
.Name("webGrid").AutoBind(true).Scrollable(scr=>scr.Height(430))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetProducts", "Home")
)
.ServerOperation(false)
)
.Columns(columns =>
{
columns.Template(@<text></text>).ClientTemplate(@MyHelpers.ProductDetail("#: Style #, #: DefaultColor #, #: Name #").ToHtmlString());
})
.Pageable()
.Scrollable()
)