[RESOLVED] auto post back is clearning my validation errors....
Ok i have setup validation using RequiredFieldValidator etc, works great. here's the problem... if you press submit and there are errors, the error messages display, then if the user selects something from my dropdown list which has AutoPostBack on then the errors disappear til u press submit again. how can i fix this? fyi i have autopostback on because i need to check weather a certain item is selected in that dropdownlist to display another textbox.
Using VS 2003, C# Webform
Re: auto post back is clearning my validation errors....
Did you set the .EnableViewState = True for the validator either in code or via the validators property in the property window?
Re: auto post back is clearning my validation errors....
I don't see anything wrong with that behavior, since that was what the ddl was meant for.
Set the DropDownList's CausesValidation property to True.
Re: auto post back is clearning my validation errors....
sorry guys i just got back into the office.
RobDog888: I set the EnableViewState = True for the validator via the validators property in the property window.
mendhak: i could really care less about whats its doing, and i agree with you, but my boss wants it fixed... :( on the other hand if a user creates an error it needs to stay on the page until that error is corrected, otherwise if it disappears the user will hit submit again and still have to fix the error b4 continuing, which takes more time for the user.
Re: auto post back is clearning my validation errors....
Of course it is clearing your errors. You are using basically .net generate client side script to validate on the client. That goes away on a postback. You have to re-validate ont the round trip. Each valitator should have a "controlname.validate()" method. You have to call that in the DDL's selectedindex change event.
if (Myvalidator.Enabled )Myvalidator.Validate();
Re: auto post back is clearning my validation errors....
Did you set the CausesValidation property?
Re: [RESOLVED] auto post back is clearning my validation errors....
thx MasterBlaster, that was the exact code i needed, it working great now :)