Sunday, 15 August 2010

Switch Statement in Kendo Template -



Switch Statement in Kendo Template -

im using kendo template , able create conditional statement (if statement) stated on documentaion. here's code.

#if ((item.controltype) == "tbx"){# @(html.kendo().autocomplete() .name("#=ctrlid#") .toclienttemplate()) #}#

this works fine.

but i'd have switch case statement. i've tried doesn't work. says "invalid template".

# switch (item.controltype) {# # case "tbx": # @(html.kendo().autocomplete() .name("#=ctrlid#") .toclienttemplate()) # break; # # }#

am missing something? or impossible kendo template interpret switch case statements? (about latter, dont think so..i'm missing something)

can help me please? thanks!^^

i check case , found reason error. maintain javascript valid have utilize 1 pair of # symbols surounding switch statement , first case statement.

e.g.

instead of:

# switch (item.controltype) {# # case "tbx": #

use:

# switch (item.controltype) { case "tbx": #

to demonstrate , here jsbin. there should not problems if combine switch widget generated mvc wrappers. if there is, allow me know.

templates switch-statement kendo-ui

No comments:

Post a Comment