This question is locked. New answers and comments are not allowed.
Hi,
I want to have ajax binding and template.
I saw that: http://demos.telerik.com/aspnet-mvc/razor/grid/templatesclientside
But I don't understand the synthax. Why should I use aspx tags since I'm with the razor engine?
Can I have a conditional display(e.g. having date coming in red if the date is already past?)
I want to have ajax binding and template.
I saw that: http://demos.telerik.com/aspnet-mvc/razor/grid/templatesclientside
But I don't understand the synthax. Why should I use aspx tags since I'm with the razor engine?
Can I have a conditional display(e.g. having date coming in red if the date is already past?)
6 Answers, 1 is accepted
0
nachid
Top achievements
Rank 1
answered on 02 Feb 2012, 12:57 PM
I cannot see where you're seeing this aspx tag.
Regarding the conditionnal display, you can use the conditional formatting
However, this last one is available only in server binding mode.
Regarding the conditionnal display, you can use the conditional formatting
However, this last one is available only in server binding mode.
0
Julien
Top achievements
Rank 1
answered on 02 Feb 2012, 01:05 PM
A screenshot showing tags:
http://screencast.com/t/TrMymuavRqu
Why is this usable only in server binding mode? In server binding mode we can already use conditional formating in template, we don't need this. So how should I do a thing as basic than putting in red some fields on ajax binding mode?
http://screencast.com/t/TrMymuavRqu
Why is this usable only in server binding mode? In server binding mode we can already use conditional formating in template, we don't need this. So how should I do a thing as basic than putting in red some fields on ajax binding mode?
0
Hi,
Atanas Korchev
the Telerik team
Those are not ASPX tags. Those a client-side template expressions which are Telerik specific.
Here is how to make some fields red
columns.Bound(o => o.OrderID).ClientTemplate("<span style='color:red'><#= OrderID #></span>");
Atanas Korchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Julien
Top achievements
Rank 1
answered on 02 Feb 2012, 01:19 PM
Ok thank you, do you have a reference somewhere for those tags?
But like this I will have everytime the field in red.
How to have by example your OrderID appearing in red, if it has 0 as value?
But like this I will have everytime the field in red.
How to have by example your OrderID appearing in red, if it has 0 as value?
0
Hi,
Atanas Korchev
the Telerik team
Here is a link to the documentation. You can make conditional coloring by using a JavaScript function in the template
columns.Bound(o => o.OrderID).ClientTemplate("<#= template(data) #>");
<script>
function template(dataRow) {
if (dataRow.OrderID == 0) {
return "<span style='color:red'>" + dataRow.OrderID + "</span>";
}
return "<span style='color:blue'>" + dataRow.OrderID + "</span>";
}
</script>
Atanas Korchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
nachid
Top achievements
Rank 1
answered on 03 Feb 2012, 07:49 AM
Thank you Atanas,
That's really great and I just discovered we can use a function in the template the way you mentioned.
However, I am wondering from where come this value data
Shouldn't be dataItem only?
That's really great and I just discovered we can use a function in the template the way you mentioned.
However, I am wondering from where come this value data
Shouldn't be dataItem only?