terbubbs
terbubbs

Reputation: 1512

ASP GridView FilterExpression for All Columns

I am displaying a gridview with several columns of data.

I want to give the user the ability to search any column of that gridview with a textbox string.

I know I can use a FilterExpression to search by a specific column, but is there a way to designate the column name with a "*" symbol or anything representing [ALL] columns?

Upvotes: 0

Views: 872

Answers (1)

TFrost
TFrost

Reputation: 777

You can send textbox string as a parameter for a procedure which will filter data for the gridview. For example to filter employee data in gridview we can create procedure like..

create procedure employee_search    
    @search nvarchar(10)
as
begin
select
    e_name,e_address,e_email    
from employee
where       
    e_name like '%'+@search+'%' or 
    e_address like '%'+@search+'%' or       
    e_email like '%'+@search+'%' 
end

Send textboxt string as a parameter just like @search in the procedure and later bind result to gridview.

I am not sure whether you were looking for this answer. Hope this works for you.

Upvotes: 1

Related Questions