Kendo UI grid ClientTemplate

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?

Answers


I changed my template to:

columns.Bound(p => p.symbol).ClientTemplate("<a href=javascript:selectSymbol(\'" + "#: symbol #" +"\')>#: symbol #</a>");

It works fine now.


Need Your Help


About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.