Wrox Programmer Forums
|
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 7th, 2009, 10:40 PM
Registered User
 
Join Date: Jan 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
 
Old January 8th, 2009, 02:03 AM
Authorized User
 
Join Date: Dec 2008
Posts: 18
Thanks: 1
Thanked 0 Times in 0 Posts
Default

the grid view shows 'only' when its filled with data from the DB(or u fill with static data ) its not like u want the grid view in ur page load its goind to happen only at the click event.. since the gridview is going to be populated based on the search criteria it wont show anyway... u can use boundfiled for fetching data from DB n for Links use templatefiled n there is something called as EmptyDataTemplate in GV use that when u've no results returned Happy Coding
__________________
Yamini





Similar Threads
Thread Thread Starter Forum Replies Last Post
Settings to a simple access to a SQL database tedhill Classic ASP Databases 0 July 21st, 2005 04:25 AM
Simple site search jasondavey Dreamweaver (all versions) 4 July 4th, 2005 03:36 PM
simple database problem? juergreh Beginning PHP 3 April 20th, 2005 10:32 AM
Save simple record via web form t sql database kbarsi VB Databases Basics 1 January 30th, 2005 11:29 AM
Simple Database Question Nick.Net VB.NET 2002/2003 Basics 2 December 8th, 2003 05:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.