Click here to Skip to main content
12,944,121 members (52,255 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
Comments
Arjun YK 2-Jul-12 3:35am
   
can u please be clear with the question.
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
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
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Hi

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[^]
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

1.If YOu are binding grid in code behind refer this
http://msdn.microsoft.com/en-us/library/system.data.dataview.rowfilter.aspx

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">
</asp:GridView>
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT DISTINCT * FROM [Contract]" FilterExpression="contractID LIKE '{0}%' AND duration LIKE '{1}%'">
<FilterParameters>
<asp:ControlParameter ControlID="contractID" Name="contractID"
PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="duration" Name="duration" PropertyName="Text"
Type="String" />
</FilterParameters>
</asp:SqlDataSource>
  Permalink  
v2

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
OriginalGriff 4,653
CHill60 2,970
Maciej Los 2,388
Jochen Arndt 1,900
ppolymorphe 1,765


Advertise | Privacy | Mobile
Web01 | 2.8.170518.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