Hi,
I'm using Kendo UI Grid with a custom popup editor template and AngularJs. I'm also using localization like this example with IViewLocalizer. However, localization replace the exclamation mark by ' so my template is crashing with this error:
angular.js:13236 Error: Invalid template:'
<div dir-loadtemplate>
<div class=
"k-edit-label"
><label
for
=
"AssignmentType"
>Type d&
#x27;assignation :</label></div>
<!--<div class=
"k-edit-field"
><input ng-model=
"AssignmentType.AssignmentTypeId"
k-options=
"assignmentDropDownOptions"
kendo-dropdownlist k-value-primitive=
"false"
/></div>-->
<div class=
"k-edit-field"
>
<select name=
"AssignmentType"
id=
"AssignmentType"
k-on-change=
"onChangeAssignmentType(kendoEvent)"
data-bind=
"value: AssignmentType"
k-data-source=
"assignmentTypeDataSource"
kendo-dropdownlist k-data-text-field=
"'Description'"
k-data-value-field=
"'Id'"
data-option-label=
"{Description:'',Id:null}"
data-assignmentTypeValidation-msg=
"Assignment type is required"
/>
<span class=
"k-invalid-msg"
data-
for
=
"AssignmentType"
></span>
</div>
Source code is very simple:
<
script
type
=
"text/x-kendo-template"
id
=
"template"
>
<
div
dir-loadtemplate>
<
div
class
=
"k-edit-label"
><
label
for
=
"AssignmentType"
>@LocString["STR_AssignmentType"] :</
label
></
div
>
<!--<div class="k-edit-field"><input ng-model="AssignmentType.AssignmentTypeId" k-options="assignmentDropDownOptions" kendo-dropdownlist k-value-primitive="false" /></div>-->
<
div
class
=
"k-edit-field"
>
<
select
name
=
"AssignmentType"
id
=
"AssignmentType"
k-on-change
=
"onChangeAssignmentType(kendoEvent)"
data-bind
=
"value: AssignmentType"
k-data-source
=
"assignmentTypeDataSource"
kendo-dropdownlist
k-data-text-field
=
"'Description'"
k-data-value-field
=
"'Id'"
data-option-label
=
"{Description:'',Id:null}"
data-assignmentTypeValidation-msg
=
"Assignment type is required"
/>
<
span
class
=
"k-invalid-msg"
data-for
=
"AssignmentType"
></
span
>
</
div
>
I tried to replace ' by '' in the localization methode without success:
protected
string
GetStringSafely(
string
name, CultureInfo culture)
{
var resourceValue =
string
.Empty;
#if DNX452
var cultureName = (culture ?? CultureInfo.CurrentUICulture).Name;
//var resourceFile = _resourceManager.BaseName.Substring(_resourceManager.BaseName.IndexOf('.') + 1) + "." + cultureName;
var resourceFile =
"Resource"
+
"."
+ cultureName;
var filePath = Path.Combine(_applicationBasePath,
"Resources"
,
"bin"
);
if
(File.Exists(Path.Combine(filePath, resourceFile +
".resources"
)))
{
_resourceManager = ResourceManager.CreateFileBasedResourceManager(resourceFile, filePath,
null
);
}
#endif
try
{
// retrieve the value of the specified key
resourceValue = _resourceManager.GetString(name).Replace(
"'"
,
"''"
);
}
catch
(MissingManifestResourceException)
{
return
name;
}
return
resourceValue;
}
Any idea how to fix it?
Thank you