Simple database search example
I am migrating from ASP to ASP.Net, and I'm looking for a simple example of a search page (with 4-5 fields which could be entered by the user), which connects to a database and returns the results of the search. I've done this many times in classic ASP, but it always involved writing all the code by hand.
I've looked pretty extesively at the GridView in ASP 3.5, and obviously it's pretty simple to display records from a database.
What I need the search page to do is the following:
1. On initial display of the page, don't display anything in the GridView (since the user hasn't entered any search criteria yet)
2. When displaying the results of the search, one column returned might be static text in some cases, in other cases it will be a URL to an online document.
3. If the search returns no results (or "hits"), don't display the GridView, but display an "no records found" message. Does the "EmptyDataText" property work in this scenario?
Thanks.
|