Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validation
Message
 
To
05/06/2003 16:57:50
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
00796947
Message ID:
00797552
Views:
10
>when i query a database, if no records are returned i want to pop up a messagebox, otherwise go to the proper page. what is the best practice for this procedure? use a validation control or some other method? thanks for the help.

Depends how your form is laid out. I'd say a validation control has nothing to do with this so that's not a good choice.

If you're sitting on a query page that goes off to another page that shows the data then I would simply display an error message in a label. In most cases this is easier than using validation controls and more effective and flexible to boot. Just leave it empty by default and set it when the query fails.

However, I don't really understand your logic here. With ASP.Net you should probably have your query and your result on the same page. If not then you can't really use most of the features that a Web form provides in the first place as you are not posting back to the current form, but posting to another form. This is more ASP classic style, which is fine for many situations...

In that scenario I would just display an error message on the result page or right away redirect back to the query page. You can also store an error message in session state if you need to display it back on the original page.


ASP.Net is not really well set up for the latter scenario, but you can certainly make it work like classic ASP if need be.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform