I'm binding client templates to columns in my kendo ui grid as you see below:
@(Html.Kendo().Grid(Model)
.Name("marketWatchGrid")
.Columns(columns =>
{
columns.Bound(p => p.direction).ClientTemplate(
"# if (direction==1) {#" +
"▲" +
"#}#" +
"# if (direction==0) {#" +
"▼" +
"#}#"
).Title("").Width(30);
columns.Bound(p => p.symbol).ClientTemplate("<a href='javascript:selectSymbol('" + "#: symbol #" +"')'>#: symbol #</a>"); ;
columns.Bound(p => p.bid);
columns.Bound(p => p.ask);
})
.Scrollable()
)
The following template does not work:
columns.Bound(p => p.symbol).ClientTemplate("<a href='javascript:selectSymbol('" + "#: symbol #" +"')'>#: symbol #</a>"); ;
I'm getting Javascript syntax error. How can I fix this?
I changed my template to:
columns.Bound(p => p.symbol).ClientTemplate("<a href=javascript:selectSymbol(\'" + "#: symbol #" +"\')>#: symbol #</a>");
It works fine now.