I need to perform validations against database. If row exists then it should populate error. For this i have used "ValidatingFieldInput" event. For insert it is working fine. When i am trying to update the then this validation is fired and always returns error message. Can any one tell me how to avoid this problem. Here is the sample code i am using this validation need to execute for insert and update (only if old vale and new value is not same)
protected void grdAssetTypes_ValidatingFieldInput(object sender, FieldInputValidationEventArgs e) {
if (e.Field.DataPath == "AT_str_AssetType") {
dsATAR.ATAR_AssetTypesRow ARow = null;ARow = AtarAssetDT.FindByAT_str_AssetType(e.InputValue.ToString());if (ARow != null) { e.ErrorMessage = "Error: Asset Type Exists";e.IsValid = false; }
}
}