how to make multiple search for datagrid...

Multiple search in the sense searching based on multiple column values?

yes...both data from column 1 & 2 can be search ni 1 texbox...

For, this type of things. Better to take the values in the textbox and rebind the data in the database, but with the where condition in the sql query. And in the resultant Dataset only the required search results will be there, later bind the resultant dataset to the datagrid.

i use this query to search data from column 1..

LIKE ? + '%'

can i use this 2 both column ?

you can't use the LIKE keyword for filtering the values in the Database for both columns, because they both have different values of different datatypes. Use only where keyword for the filter.

i see...why i can't use LIKE on date filter...

I you use LIKE keyword for two different columns in a table of the database, then conflicts occur at that time, you will get wrong result.

ok...how to search data in datagrid by date only??

what query i need ??

Ok, if you want to do that follow the code below.

Dim dView As New DataView
                dView = Session.Item("ReportDS")
                Session.Item("ReportDS") = ""
                dView.RowFilter = strCondition.ToString
                Session.Item("ReportDS") = dView
                CMSgrid.DataSource = dView

how to declare this...
strCondition
Session
CMSgrid

("ReportDS") are this column..

strCondition is an string in which you have to give the Condition what you want to filter i.e., for ex

strCondition="Empno =" & empno & "and" & "Empname ='" & empname & "'"

, CMSgrid here means the gridview name ok, give the gridview id which you have given at that place, and the

Session.Item("ReportDS")

is nothing but the session variable. When you bind the values at first time from the database, pass the dataset you have retrieved into this session variable for sorting the records.

("ReportDS" are this column name ??

Hello, "ReportDS" is not column name its session name ok. The combined

Session.Item("ReportDS")

is called as Session variable, you can use any name as giving for a session variable. And dont seperate the "ReportDS" and Session ok.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.