I have textboxes in grid ,if the value in that textbox other than p,A,HA,HL i want to give alert message i wrote the code but javascript is not fired
in the code i bind script on Rowdatabound of grid
<
script language="javascript" type="text/javascript">
function GetMessage(ctrlText) {
var ctrl1 = document.getElementById(ctrlText);
//alert('hi');
if (ctrl1.value != '') {
if (ctrl1.value != 'P' || ctrl1.value != 'A' || ctrl1.value != 'L' || ctrl1.value != 'HL' || ctrl1.value != 'HA' || ctrl1.value != 'WO' || ctrl1.value != 'PH' || ctrl1.value != 'OS ' || ctrl1.value != 'CC' || ctrl1.value != 'CA') { alert(
'Only Enter value in Legends.'); }
}
}
</script>
txt2.Attributes.Add(
"onBlur", "javascript: return GetMessage('" + txt2.ClientID + "'"); txt3.Attributes.Add(
"onBlur", "javascript:GetMessage('" + txt3.ClientID + "'"); txt4.Attributes.Add(
"onBlur", "javascript:GetMessage('" + txt4.ClientID + "'"); txt5.Attributes.Add(
"onBlur", "javascript:GetMessage('" + txt5.ClientID + "'"); txt6.Attributes.Add(
"onBlur", "javascript:GetMessage('" + txt6.ClientID + "'"); txt7.Attributes.Add(
"onBlur", "javascript:GetMessage('" + txt7.ClientID + "'");
Software/Hardware used:
c#.net,Javascript
ASKED:
December 31, 2010 6:27 AM
UPDATED:
March 5, 2011 6:03 AM