This question is locked. New answers and comments are not allowed.
Hi all im kind of new using Telerik Grid, basically what im trying to accomplish here is the following scenario, i have a form that have some fields and via ajax calls another action on my controller to generate the model to a partial view that have the following grid, my problem is that i need to create some actions depending on some business logic, i know i can do that using a column template, the thing is that since im using ajax binding it "loose" my template, looking around on internet i found that u can do that using a js function go generate the links, my question is isnt that kind of messy ?? im duplicating the same business logic on the server and on the client, there's must be a better way to accomplish this ??
Html.Telerik().Grid(Model)
.Name("Grid")
.DataBinding(binding => binding.Ajax().OperationMode(GridOperationMode.Client))
.Columns(column =>
{
column.Bound(c => c.Id).Title("Id").Width(30);
column.Bound(c => c.Status);
column.Bound(c => c.DateReg);
column.Template(
@<text>
<div class="ActionsProvGrid">
<a href="@Url.Action("SomeAction", "Controller", new {id = item.id})">
<img src="../../Content/icons/ViewMore.png" alt="ViewMore" />
</a>
@if (@item.Status.Equals("ACT"))
{
<a href="@Url.Action("SomeOtherAction", "Controller", new {idOportunidad = item.id})">
<img src="../../Content/icons/invoice.png" alt="invoice"/>
</a>
}
</div>
</text>
).ClientTemplate("<#= GenearteIcons(data) #>");
})
.Sortable()
.Render();
Html.Telerik().Grid(Model)
.Name("Grid")
.DataBinding(binding => binding.Ajax().OperationMode(GridOperationMode.Client))
.Columns(column =>
{
column.Bound(c => c.Id).Title("Id").Width(30);
column.Bound(c => c.Status);
column.Bound(c => c.DateReg);
column.Template(
@<text>
<div class="ActionsProvGrid">
<a href="@Url.Action("SomeAction", "Controller", new {id = item.id})">
<img src="../../Content/icons/ViewMore.png" alt="ViewMore" />
</a>
@if (@item.Status.Equals("ACT"))
{
<a href="@Url.Action("SomeOtherAction", "Controller", new {idOportunidad = item.id})">
<img src="../../Content/icons/invoice.png" alt="invoice"/>
</a>
}
</div>
</text>
).ClientTemplate("<#= GenearteIcons(data) #>");
})
.Sortable()
.Render();