Click here to Skip to main content
13,143,008 members (54,163 online)
Rate this:
Please Sign up or sign in to vote.
i want to filter grid view from dropdownlist and text box , like i select the column from dropdown and name,id,phone number anything from text box how can i do this process
Posted 1-Jul-12 21:29pm
Arjun YK 2-Jul-12 3:35am
can u please be clear with the question.
ooffooooo 2-Jul-12 3:46am
i have a gridview i want to filter that grid view , drop down list should will select the column and text box will filter the column.
like in ID NAME Phone Designation fields in gridview . i will select Designation in dropdown and type programmer in text box .so it should filter programmers from the gridview
Sandeep Mewara 2-Jul-12 3:37am
Not clear. Dropdown & textbox are inside grid or outside?
ooffooooo 2-Jul-12 3:43am
dropdownlist and text box should be outside the gridview
Rate this: bad
Please Sign up or sign in to vote.

Solution 3


i hope it will help you
we can use data views to filter the data in grid view

Filter the data in Grid view[^]

sorting data in grid view header selection[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

1.If YOu are binding grid in code behind refer this

2.If you are using SqlDatsource
<asp:textbox id="contractID" runat="server" >duration</asp:textbox>
<asp:textbox id="duration" runat="server" >duration</asp:textbox>
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1">
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT DISTINCT * FROM [Contract]" FilterExpression="contractID LIKE '{0}%' AND duration LIKE '{1}%'">
<asp:ControlParameter ControlID="contractID" Name="contractID"
PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="duration" Name="duration" PropertyName="Text"
Type="String" />

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170915.1 | Last Updated 2 Jul 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100