Hi,
I am trying to validate textboxes inside a grid column. This column is having different html controls depending on source data.
For example it can have textbox in one row and dropdown in next. I am able to achieve this using client template.
I want to validate inputs in textboxes. Validation can be different for each text box. It can be for number, max length and/or custom.
I am passing list of validation attributes in source data.
This is working good unless I click on any other grid cell having client template. As soon as I click such cell the validation message is disappering.
Any help on this is greatly appricated!
Thanks
Client template code -
I am trying to validate textboxes inside a grid column. This column is having different html controls depending on source data.
For example it can have textbox in one row and dropdown in next. I am able to achieve this using client template.
I want to validate inputs in textboxes. Validation can be different for each text box. It can be for number, max length and/or custom.
I am passing list of validation attributes in source data.
This is working good unless I click on any other grid cell having client template. As soon as I click such cell the validation message is disappering.
Any help on this is greatly appricated!
Thanks
Client template code -
01.
sourceData
02.
function
CustomControlEditor(sourceData, defaultValue, templateType, controlType)
03.
{
04.
05.
if
(sourceData !=
null
&& sourceData !=
''
)
06.
{
07.
var
dd;
08.
if
(controlType ==
"Multiselect"
)
09.
{
10.
dd =
"<select id= 'dd' multiple='multiple' onchange='SensorDropDownChanged(this,\""
+ templateType +
"\");'>"
;
11.
12.
//get source data
13.
14.
//get default values
15.
16.
//populate list
17.
18.
return
dd;
19.
}
20.
else
if
(controlType ==
"Dropdownlist"
)
21.
{
22.
dd =
"<select id= 'dd' onchange='SensorDropDownChanged(this,\""
+ templateType +
"\");'>"
;
23.
24.
//get source data
25.
26.
//get default values
27.
28.
//populate list
29.
30.
return
dd;
31.
}
32.
33.
//textbox sourceData is list of validation attributes
34.
else
{
35.
36.
var
tb;
37.
38.
if
(defaultValue !=
null
)
39.
{
40.
41.
tb =
"<input id= 'tbText' type='text' value='"
+ defaultValue +
"' onblur='SensorTextBoxChanged(this,\""
+ templateType +
"\");' "
+ sourceData +
"/>"
;
42.
}
43.
else
44.
{
45.
tb =
"<input id='tbText' 'tb' type='text' 'onblur='SensorTextBoxChanged(this,\""
+ templateType +
"\");' "
+ sourceData +
"/>"
;
46.
}
47.
return
tb;
48.
}
49.
}
50.
51.
52.
}