6 Answers, 1 is accepted
You could add the template in a script block and compile it in a separate one. For example:
Then you could use the compiled template variable in the Grid configuration:
I wish you a great day! Regards,
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
I'm using external template, but Visual Studio Editor show the syntax warning in .cshtml -
"Attribut # already exists"
HTML Element with dynamic attribute :
<script id="rowTemplate" type="text/x-kendo-template">
var loopRadioCheckedHtml = (loopRadioChecked) ? "checked='checked'" : ""; // HTML checked
<input type="radio" ... #= loopRadioCheckedHtml # ... />
*syntax warning for #= loopRadioCheckedHtml # (1st # char identified as attribute name, 2nd # char syntax warning).
May I ignore this syntax warning and is there have any side effects for view file execution ?
*There have no error after test.
If the view engine compiles the view with no exceptions you should not face any trouble.
Nevertheless, if the warning bothers you, I can suggest you to override the default code analysis rules. Please refer to the following article for further information: