Searching GridView Data in ASP.NET


Today, when visiting a community website, I found below article left unpublished with some comments about Language and Grammar. I am sharing this with you as it was. This was written on the initial days of year 2012 when I started learning .NET technology. This is basic one but I hope this is helpful to you.


In this article, I am going to demonstrate, How to (Filter) Searching GridView data (outside Gridview) according to the selections in Dropdown List or any textbox control.


Sometime, we need to filter our Data, which is for record analyzing and study. So this is how we will filter our GridView Data according to any parameter passed from Page at run time.

We Are Using:

Visual Studio 2010, SQL Server 2008, XHTML 4.01, C# as Code Behind Language

What We Want:

Lets have a look at below Snapshots to Understand what we are going to do. We try to apply filter (searching) GridView.
GridView Data Before Clicking Filter Button with Filter Options:
searching gridview

Using the code

Here is code for ASPX Code.

Now have a look at the code of complete .cs Page and what is behind the Page and Commands.

Now GridView Data After Clicking Filter Button (Applying filters):
searching gridview
Hope these snaps which would establish the implementation.

We used Dropdown Lists filled statically for Monthname and Mode as you can see in code. We Dynamically Bind Party names from Database.


After writing this code, I hope it will helpful to you. This code is running perfectly in my machine and you have applied searching GridView feature. You can enhance the code and design as per your design and requirement.

You might also like More from author