c# - Prevent the second event firing when the first is invalid + asp.net -


i have 2 custom server validate methods associated 2 drop downs respectively. when there post both methods seems fire. need prevent second 1 firing if first fails validation. here methods

protected void customvalidatorcountryofcitizenshipservervalidate(object source, servervalidateeventargs args)         { }  protected void customvalidatorsecondcountryofcitizenshipservervalidate(object source, servervalidateeventargs args)         { } 

i tried setting causes validation of second dropdown control false didnt work. set args of first method false true when second method gets called. help

set flag:

bool isvalidated = false;  protected void customvalidatorcountryofcitizenshipservervalidate(object source, servervalidateeventargs args) {     // validation code     isvalidated = true; }  protected void customvalidatorsecondcountryofcitizenshipservervalidate(object source, servervalidateeventargs args) {     if (!isvalidated)         return;     // ... } 

Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -