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

[Solved] Custom Cliente Template MVC Grid

1 Answer 62 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jose
Top achievements
Rank 1
Jose asked on 21 Oct 2012, 11:00 PM
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();

1 Answer, 1 is accepted

Sort by
0
Jose
Top achievements
Rank 1
answered on 28 Oct 2012, 04:32 PM
anybody ??
Tags
General Discussions
Asked by
Jose
Top achievements
Rank 1
Answers by
Jose
Top achievements
Rank 1
Share this question
or