using try..catch in webforms...

appagnellewoF

New Member
Anyone had success using try..catch..finally..end catch in a form. It appears that the try block will not release the old value...here is a sample<BR><BR>try<BR>sample as integer = request.form("test")<BR><BR>catch ex as formatexception<BR> output.text &= "error. Entered an invalid"<BR>end try<BR><BR>What will happen is the try block will catch an error if the value is other than an integer and produce my custom error. However when i change the value to an integer the error doesn't disappear. NOW i could use a regular expression but It seems to me to be easier to loop through an entire form with try..catch as opposed to using multiple regex's. Any suggestions?either set output.text = "" at the top of your try block, or remove it from the viewState. It is hard to give direction without more contextual information.I would prefer using the regular expression validator as you can configure it to run on client side as javascript..
 
Back
Top