Tuesday, April 20, 2010

Set Active Tab in Ajax tab Panel When validate is fire

You can simplify this java script for doing this.

function SetActiveTab() {

if (typeof (Page_Validators) == "undefined") return false;

try {

var noOfValidators = Page_Validators.length;

for (var validatorIndex = 0; validatorIndex <>

var validator = Page_Validators[validatorIndex];

ValidatorValidate(validator);

if (!validator.isvalid) {

validator=document.getElementById(validator.id);

var parentTab=validator;

var parentTabNodeName=validator;

do {

parentTabNodeName=parentTab.parentNode.nodeName;

parentTab=parentTab.parentNode;

} while ((parentTabNodeName!='DIV')||($find(parentTab.id)==null)||($find(parentTab.id)=='')||(parentTab.className !='ajax__tab_panel'));

if((parentTab.className =='ajax__tab_panel')){

var tabPanel = $find(parentTab.id);

var tabContainer =tabPanel.get_owner();

tabContainer.set_activeTabIndex(tabPanel.get_tabIndex());

}

break;

}

}

return false;

}

catch (Error) {

}

}


Call button click (In asp button On client Click)




No comments:

Post a Comment