This question is locked. New answers and comments are not allowed.
Hey all,
So I hope to do the above, similar to:
But rather:
In the second example, I don't get my bound data in my method. Instead it's just "<#= Name #>"
In short, I'm trying to bind an IEnumerable property of my main IEnumerable that the grid is bound to, for a list of checkboxes in a column.
Thanks!
So I hope to do the above, similar to:
ClientTemplate("<br />" + @Html.Label("<#= Name#>") + "<br />")But rather:
ClientTemplate("<br />" + Model.Function("<#= Name #>") + "<br />")In the second example, I don't get my bound data in my method. Instead it's just "<#= Name #>"
In short, I'm trying to bind an IEnumerable property of my main IEnumerable that the grid is bound to, for a list of checkboxes in a column.
Thanks!
5 Answers, 1 is accepted
0
Hello Jon,
The client template is executed client-side. As a result you cannot call server-side code (such as Model.Function) in it. There are two options
Atanas Korchev
the Telerik team
The client template is executed client-side. As a result you cannot call server-side code (such as Model.Function) in it. There are two options
- Switch to server binding and use a server template
- Convert the code from Model.Function to JavaSript:
ClientTemplate("<br/> <#= myFunction(Name) #> <br/>")
<script>
function myFunction(name) {
return "<strong>" + name + "</strong>";
}
</script>
Atanas Korchev
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
0
Jon Baron
Top achievements
Rank 1
answered on 19 Jul 2012, 12:22 PM
Thank you very much.
Can you please point out an example of the server side piece?
Thanks!
Can you please point out an example of the server side piece?
Thanks!
0
Hello Jon,
Atanas Korchev
the Telerik team
Here is an example which is showing how to use server templates: http://demos.telerik.com/aspnet-mvc/grid/templatesserverside
All the best,Atanas Korchev
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
0
Jon Baron
Top achievements
Rank 1
answered on 19 Jul 2012, 01:23 PM
Great thanks!
Last question: How can a columns value be passed into an EditorTemplate?
Thanks!
Last question: How can a columns value be passed into an EditorTemplate?
Thanks!
0
Hello,
Atanas Korchev
the Telerik team
It depends on the binding mode of your grid. Are you using server or ajax binding mode?
In server binding mode the whole model is available in the editor template. Use the Model property.
In ajax binding mode you need to use OnEdit event.
Atanas Korchev
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.