This is a migrated thread and some comments may be shown as answers.

[Solved] Embedded executable code within client template

0 Answers 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sreenivas
Top achievements
Rank 1
Sreenivas asked on 21 Oct 2011, 12:01 AM
I have a grid, one of whose columns shows week day (Sunday, Monday, etc...).  This value is stored as an integer between 0 and 6 in the database.  I am using client template for this column my Ajax bound grid.  Here is the code snippet:
columns.Bound(g => g.WeekDayNumber)
.ClientTemplate(
"<# switch(WeekDayNumber) {case 0: <span>Sunday </span>;case 3: <span>Thursday</span>;break;case default: <span>Sunday</span>; break;}#>")

I am getting the following error during debugging:

Microsoft JScript compilation error: Syntax error

I validated that the above code is the offending one (when I replaced the client template code with static "<span>Sunday</span>", it works)

I am not able to find any discussions that can point me in the right direction.

Please help me fix this.

Thanks
Tags
Grid
Asked by
Sreenivas
Top achievements
Rank 1
Share this question
or