Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP ASP.NET ADO.NET
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 22:29pm
Comments
Arjun YK at 2-Jul-12 3:35am
   
can u please be clear with the question.
ooffooooo at 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 at 2-Jul-12 3:37am
   
Not clear. Dropdown & textbox are inside grid or outside?
ooffooooo at 2-Jul-12 3:43am
   
dropdownlist and text box should be outside 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
0 OriginalGriff 400
1 Sergey Alexandrovich Kryukov 329
2 Afzaal Ahmad Zeeshan 264
3 BillWoodruff 245
4 CPallini 195
0 OriginalGriff 5,560
1 DamithSL 4,476
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 2 Jul 2012
Copyright © CodeProject, 1999-2014
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