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

Query on using the ClientTemplate on Grid with Ajax Binding

3 Answers 30 Views
This is a migrated thread and some comments may be shown as answers.
Uday
Top achievements
Rank 1
Uday asked on 11 Sep 2014, 04:07 PM
Hi,

I am trying to call a Html extension helper method  'GetUserFormattedId' from the client template of  a ajax bound grid column. I am trying the format a value of the column.

I am unable to get it working. Is it allowed to call extension methods in this way? Please advise. 

@{
          Html.Kendo().Grid<InvoiceSummaryDto>()
          .Name("invoiceAccountingGrid")
          .Columns(columns =>
          {
              columns.Bound(l => l.Id).ClientTemplate("<a href='" + @Url.Action("Details", "Invoice", new { area = "Accounting" }) + "/#= Id #'" + ">" + @Html.GetUserFormattedId(@"#= Id #") + "</a>").Title("ID");
              columns.Bound(l => l.ItemsDescription).Title("Description");
                    
          })

I

3 Answers, 1 is accepted

Sort by
0
Accepted
Dimiter Madjarov
Telerik team
answered on 12 Sep 2014, 10:25 AM
Hi Uday,


The Html helper cannot be used this way. The reason for this is that it is evaluated on the server side, while the client template is evaluated later on the client side, when the data is bound. This means that the Id value cannot be passed for formatting.

Regards,
Dimiter Madjarov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Uday
Top achievements
Rank 1
answered on 12 Sep 2014, 10:10 PM
Hi Dimiter,

It makes sense now. I ended up writing a Javascript for the same so that it can evaluated on the client side.

Thanks for your time.
0
Dimiter Madjarov
Telerik team
answered on 15 Sep 2014, 07:44 AM
Hello Uday,


Thanks for the update. I am glad the information was helpful.

Have a great day!

Regards,
Dimiter Madjarov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Uday
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Uday
Top achievements
Rank 1
Share this question
or