Sponsored Links
ASP.NET 2.0 Tutorials
- Advanced Site Functionality - ASP.NET 2.0
- ASP.NET : Dynamic Image control
- ASP.NET 2.0 Creating Web Wizards
- Displaying Master-Detail Data on Separate Pages in ASP.NET 2.0
- ASP.NET Displaying Master-Detail Data on the Same Page
- ASP.NET DataBound Controls - Details View
- ASP.NET : Using a Grid to Display Detail Information
- ASP.NET 2.0 : Adding Sorting and Paging in GridView
- ASP.NET 2.0 Tutorials : GridView Filtering
- ASP.NET GridView Control
- ASP.NET 2.0 Training : Data Bound Controls
- ASP.NET 2.0 Free Tutorials : SqlDataSource Control
- ASP.NET 2.0 Training : Data Source Object Model
- ASP.NET 2.0 Free Training : Setting Application-Level Caching
- ASP.NET 2.0 Tutorials : Configuring Page-Level Caching
- ASP.NET 2.0 Free Tutorials : Managing Membership and Roles
- ASP.NET 2.0 Free Tutorials : State Management And Caching in ASp.net 2.0
- Forms Authentication in ASP.NET 2.0
- ASP.NET 2.0 Training : ASP.NET Security
- ASP.NET 2.0 Training : Customizing the Session State Mechanism
Tutorials
ASP.NET 2.0ASP.NET 2.0 Tutorials : GridView Filtering
Table of Contents
ASP.NET 2.0 Tutorials : GridView Filtering
ASP.NET 2.0 Tutorials : GridView Filtering - Page 2ASP.NET 2.0 Tutorials : GridView Filtering
ASP.NET 2.0 Tutorials : GridView Filtering
In this tutorial you will learn how to add a filter to a Grid View Control, To modify the query with a parameterized filter, the WHERE Clause, Parameter properties, Parameter Value Editor and To test filtering.
Adding Filtering
If the developer wants to display only selected data in a page, the query for the SqlDataSource control will have to be modified. The first step in this process is to add a Textbox control where the users can enter the filter condition. The filter condition then becomes the parameterized filter (WHERE clause).
1. In the Toolbox, from the Standard folder, drag a TextBox control and a Button control onto the page.
2. The Button control is used only to post the page to the server.
3. In the Properties window for the TextBox control, set the ID property to StudentNametext.
4. Type Student Name or similar text before the text box to act as a caption.
5. In the Properties window for the Button control, change the Text property to Submit.
The query will now have to be modified to add the filter.
To modify the query with a parameterized filter
1. Right-click the SqlDataSource control, and then click Show Smart Tag.
2. On the SqlDataSource Tasks menu, click Configure Data Source

3. The Configure Data Source < Datasourcename > wizard appears.
4. Click Next.
5. The wizard displays the SQL command currently configured for the SqlDataSource control.

6. Click WHERE.
7. The Add WHERE Clause page appears.

8. In the Column list, click Student Name.
9. In the Operator list, click =.
10. In the Source list, click Control.
11. Under Parameter properties, in the Control ID list, click StudentNameText.
12. The preceding five steps specify that the query will get the search value for Student Name from the TextBox control that was added in the preceding procedure.

13. Click Add.
Next Page: ASP.NET 2.0 Tutorials : GridView Filtering - Page 2
Comments
Abbad said:
| Thanks for this article. Helped :) |
JUSTIN said:
| You Rule |
DYim said:
| Very nice tutorial! =) Thanks! |
sadjoker said:
| hi. good working but something is missing. If we want to show all data when the page is load, what can we do? this is the one of I am searching..!!! |
Chamindra said:
|
Thank you so much for this tutorial ! I learned a lot :) |
Red said:
| outstanding!!! |
Thia said:
| Hi :) Very useful tuto! But I have a little request... How can I filter my gridview by the column I select in a dropDownList? |
Shela said:
|
That was nice , Thanks. Is there is a way that the search could be on text change not after submitting button, also one that can be done using javascript to avoid the post back that will cause performance problems in the application. Please advice . Thanks in advance. |
dhiraj said:
| nice tutorial dear.It helps me a lot. |
Lipi said:
|
hi , thanks for this tutorial..... But I am unable to show this GridView Filtered data in the Model popup extender(AJAX Toolkit). I could not understand the problem.... Please give any suggestion for this. |
Sponsored Links
