Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i'm using combobox not dropdown.
my problem is so simple to tell,
im getting error message while debuggimg as 'unhandelled exception by user code' in content page.
i want to exit from the remaining code to execute on that exception,by showing an alert message as 'SELECT COMBOBOX BEFORE SUBMIT BUTTON'.
Posted

There are two ways to handle this:
1) Put a try...catchblock around the code, and display your alert in the catch block.
2) Use the debugger to find out exactly what is generating the exception and fixing it, by checking before you cause the error. Since you have the debugger catching the exception, it should be obvious from your code what is causing this.

Myself, I would do option two: Exceptions should not be used as a normal part of processing: they are there to let us know when we have done something wrong, not the user!

Without a relevant code fragment, I cannot help you fix the actual problem throwing the exception...
 
Share this answer
 
Comments
Olivier Levrey 5-Apr-11 3:46am    
Have a 5 for all these wise advices ;)
Sergey Alexandrovich Kryukov 5-Apr-11 4:20am    
Agree, a 5.
--SA
I really think you should try solving the error before putting in more code.
Just a guess - looks like the combo box is being assigned a value before data has been loaded into it.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 5-Apr-11 4:21am    
Who knows... A 5 though.
--SA
Abhinav S 5-Apr-11 4:25am    
Thanks SA.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900