jr53080 Posted May 29, 2003 Posted May 29, 2003 I have a webform that takes a date as input into a textbox. The textbox is validated using the Range Validator of type date. The problem is that i also call an AutoPostBack on the textbox for the event OnTextChanged. When the autopostback fires it negates the RangeValidator. What i need is when the date is valid .. it should AutoPostBack and when it is not valid then it would throw up the Validation Error and not post back until the Validation passes. If anyone has any ideas, it would be really nice .. im thinking i need to do something with JavaScript but im not sure how to Reference objects in my C# and ASP pages.. THanks for the help Quote
Moderators Robby Posted May 29, 2003 Moderators Posted May 29, 2003 I never used the Range Validator but I assume that when a date is not valid it should not post back. Quote Visit...Bassic Software
bungpeng Posted May 30, 2003 Posted May 30, 2003 Yes, I agree with Robby. Validator control will generate both the client and server site validations, unless your browser can't support scripting, otherwise it should not postback if the user enter invalid date. If you use javascript to do the date validation, then there may be a problem because you need to manual keep those controls value in every postback process. Currently .NET will handle it for you using Viewstate (if I not mistaken). Quote
bungpeng Posted May 30, 2003 Posted May 30, 2003 Sorry for my mistake, if you are using web controls, then you still can maintain your values. What do you mean "im not sure how to Reference objects"? because web control also got it's own ID, or you can give it a "Name", then use normal Javascript to handle it. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.