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

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

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

html - jQuery UI Sortable - Remove placeholder after item is dropped -