SQLDataSource FilterExpression question

F

fniles

I am using VS 2005.
In my ASP.NET page I have a combo box that lists the columns I can search
in, a Search text box (where you can input your search word) and a Search
button.
The result of the search appears in a gridview.
I have bound the gridview to a SQLDataSource.
When the Search button is hit, I set the filterExpression for the
SQLDataSource to something like so:
filterExpression = string.Format("[{0}] LIKE '%{1}%'",
cboSearch.SelectedValue, txtSearch.Text)
SqlDataSource1.FilterExpression = filterExpression

If I select "Module" from the combo box cboSearch, I would like to filter
the SQLdatasource with something like
where MODULE1 like '%' & {txtSearch.Text} '%' or MODULE2 like '%' &
{txtSearch.Text} '%'
How can I set the filterExpression to do the above ?

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top