|
-
Jul 7th, 2006, 06:30 PM
#1
Thread Starter
Junior Member
[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
-
Jul 7th, 2006, 06:49 PM
#2
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?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 8th, 2006, 08:20 AM
#3
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.
-
Jul 10th, 2006, 10:57 AM
#4
Thread Starter
Junior Member
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.
-
Jul 10th, 2006, 06:45 PM
#5
Addicted Member
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();
"And most of the evils of society can, in fact, be cured through information. We have a society that has been disinformed and based on the disinformation has made irrational choices. And that's what I mean by 'ignorance.' People, who ordinarily might be smart, are deprived of the data by which to make a rational decision, don't have the data to do it."
Frank Zappa
-
Jul 11th, 2006, 03:04 PM
#6
Re: auto post back is clearning my validation errors....
Did you set the CausesValidation property?
-
Jul 12th, 2006, 04:24 PM
#7
Thread Starter
Junior Member
Re: [RESOLVED] auto post back is clearning my validation errors....
thx MasterBlaster, that was the exact code i needed, it working great now
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|