Would you happen to have an example of using ajax in a client template? I have the following
If I change my datasource to server() it works however my paging and editing cease working. When I change my datasource back to ajax everything else works but the parm I'm trying to my ActionMethod keeps returning null. Thanks.
                                columns.Template(c => @Ajax.ActionLink(c.UserName.ToString(), "GetPerson", "Home", null, new AjaxOptions { UpdateTargetId = "result" }, null)).Title("Index")           .ClientTemplate("<a href='/Admin/Admin/GetUserRoles/#=UserName#'>#=UserName#</a>");If I change my datasource to server() it works however my paging and editing cease working. When I change my datasource back to ajax everything else works but the parm I'm trying to my ActionMethod keeps returning null. Thanks.
5 Answers, 1 is accepted
0
                                Hello Kai,
Daniel
the Telerik team
                                        This cannot be achieved with the MVC helper since it will insert invalid for the template characters. You could add the same attributes to the anchor to use an Ajax link.
Regarding sending the parameter, I am not sure what is causing the problem. The client template looks correct. Is the parameter in the action named with the default parameter name? If yes, I will need a sample project in order to investigate what exactly goes wrong.
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
                                
                                                    Kai
                                                    
                                            
    Top achievements
    
            
                 Rank 1
                Rank 1
            
    
                                                
                                                answered on 27 Aug 2012, 01:35 PM
                                            
                                        I actually did try doing something similar to that and got a huge 'Template invalid' error.
                                        0
                                Hello Kai,
Regards,
Daniel
the Telerik team
                                        The most likely reason for the error is that a "#" character is not escaped. Please check if escaping it resolves the problem e.g.
columns.Template(c=> {})    .ClientTemplate("<a data-ajax='true' data-ajax-mode='replace' data-ajax-update='\\#result' href='" + Url.Action("GetPerson", "Home") + "'>#= UserName#</a>");Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
                                
                                                    Jim
                                                    
                                            
    Top achievements
    
            
                 Rank 1
                Rank 1
            
    
                                                
                                                answered on 01 Jul 2014, 11:08 PM
                                            
                                        columns.Bound(d => d.CaseInstanceID).ClientTemplate("<a href='" + Url.Action("NameMatchReview", "IDD", new { caseInstanceID = ???.CaseInstanceID }) + "'>#= CaseInstanceID#</a>");How do I supply the routeValues properly?
I'm not sure how to access the row item, see '???' in my code above.
I'm using an ajax grid.
Thank you,
0
                                Hi,
You should append the route values to the generated URL and evaluate them using template expressions as demonstrated in this documentation topic. For example:
Regards,
Daniel
Telerik 
 
                                        You should append the route values to the generated URL and evaluate them using template expressions as demonstrated in this documentation topic. For example:
columns.Bound(d => d.CaseInstanceID).ClientTemplate("<a href='" + Url.Action("NameMatchReview", "IDD") + "?caseInstanceID=#=CaseInstanceID#'>#= CaseInstanceID#</a>");Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!