//in Jquery
var IsRequired = "";
var IsInvalid = "";
IsRequired = 'The following fields are mandatory:<br />';
IsInvalid = 'The following are invalid:<br/>';
$('a[id$=lnkbtnupdate]').click(function () {
//Validate Type
if ($('select[id$=ddltype]').val() == "0") {
alertmessage($('select[id$=ddltype]'), $("#imgedittype"));
}
else {
removealertmessage($('select[id$=ddltype]'), $("#imgedittype"));
}
//Validaing Description
if ($('input[id$=txtDescription]').val() == "") {
str += "- Description <br/>";
alertmessage($('input[id$=txtDescription]'), $("#imgeditdesc"));
}
else {
removealertmessage($('input[id$=txtDescription]'), $("#imgeditdesc"));
}
if (str != '' && strInvalid != '') {
$('div[id$=divError]').show();
$('div[id$=divError]').attr('class', 'error');
$('span[id$=lblErrorMsg]').html(IsRequired + str + '<br/>' + IsInvalid + strInvalid);
return false;
}
else if (str != '' && strInvalid == '') {
$('div[id$=divError]').show();
$('div[id$=divError]').attr('class', 'error');
$('span[id$=lblErrorMsg]').html(IsRequired + str);
return false;
}
else if (str == '' && strInvalid != '') {
$('div[id$=divError]').show();
$('div[id$=divError]').attr('class', 'error');
$('span[id$=lblErrorMsg]').html(IsInvalid + strInvalid);
return false;
}
else
return true;
});
Saritha.rajeshkumar, if this helps please login to Mark As Answer. | Alert Moderator