validate dropdownlist inside grid view using javascript I use thes but it cannaot validate
function GridViewGL_newCompaniesValidation() {
try {
var grd = document.getElementById('<%=GdviewnewGL_Companies.ClientID%>');
// var ErrorMsg = "";
var Fieldvalue = true;
var objfocus = "";
if (grd != null) {
if (grd.rows.length != null) {
for (var i = 1; i < grd.rows.length; i++) {
var incr = i + 1;
if (incr <= 9) {
incr = '0' + incr;
}
var CompanyName = $("#" + grd.id + "_ctl" + incr + "_txtCompanyName");
var ddlIntranetSiteURL = $("#" + grd.id + "_ctl" + incr + "_ddlIntranetSiteURL").value;
var ddlAdministrator = $("#" + grd.id + "_ctl" + incr + "_ddlAdministrator").value;
if (CompanyName.val() == '') {
if (Fieldvalue == true) {
objfocus = CompanyName;
CompanyName.css({ "border": "1px solid #E80001" });
Fieldvalue = false;
ErrorMsg(Fieldvalue);
}
}
if (ddlIntranetSiteURL == "---Select---") {
if (Fieldvalue == true) {
objfocus = ddlIntranetSiteURL;
ddlIntranetSiteURL.css({ "border": "1px solid #E80001" });
Fieldvalue = false;
ErrorMsg(Fieldvalue);
}
}
if (ddlAdministrator == "---Select---") {
if (Fieldvalue == true) {
objfocus = ddlAdministrator;
ddlAdministrator.css({ "border": "1px solid #E80001" });
Fieldvalue = false;
ErrorMsg(Fieldvalue);
}
}
}
return Fieldvalue;
// alert(Fieldvalue);
}
}
} catch (e) {
alert(e.message);
}
}