T
thebison
Hi all,
I hope someone can help with this relatively simple problem.
I am building a timesheet application using ASP.NET C# with Visual
Studio 2003.As it is only a protoype application, my database has been
made in MSDE.
I have a 'View Resources' page, the purpose of which is to show all
employees, taken from that table in the database. This works fine, up
to a point. I have a DataGrid, which is done with a DataSet and a
DataAdapter. I now want the user to be able to 'filter' the DataGrid,
using a text box for input, and a 'search' button. I have tried
different ways of doing this but can't get it to work. I imagine that
it is achieved by running some kind of different SQL statement (with a
% LIKE % operator) in the btnSearch_Click method, and re-binding the
Data Grid after the filter has finished.
So for example the user could enter 'John' in the 'First Name' text box
and click 'search', and the Data Grid would refresh accordingly with
all records LIKE 'John'.
My Page_Load code looks like this currently
-------------------------------------------------------------------------
this.sqlDataAdapter1.Fill(this.dsResources1);
DataGrid1.DataBind();
sqlConnection2.Close();
this.DataGrid1.PageIndexChanged += new
System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.GridPageIndexChanged);
--------------------------------------------------------------------------------------------
Hope someone can help, I'm sure the btnSearch_Click method is where I
need to put the code.
Thanks in advance,
Al
I hope someone can help with this relatively simple problem.
I am building a timesheet application using ASP.NET C# with Visual
Studio 2003.As it is only a protoype application, my database has been
made in MSDE.
I have a 'View Resources' page, the purpose of which is to show all
employees, taken from that table in the database. This works fine, up
to a point. I have a DataGrid, which is done with a DataSet and a
DataAdapter. I now want the user to be able to 'filter' the DataGrid,
using a text box for input, and a 'search' button. I have tried
different ways of doing this but can't get it to work. I imagine that
it is achieved by running some kind of different SQL statement (with a
% LIKE % operator) in the btnSearch_Click method, and re-binding the
Data Grid after the filter has finished.
So for example the user could enter 'John' in the 'First Name' text box
and click 'search', and the Data Grid would refresh accordingly with
all records LIKE 'John'.
My Page_Load code looks like this currently
-------------------------------------------------------------------------
this.sqlDataAdapter1.Fill(this.dsResources1);
DataGrid1.DataBind();
sqlConnection2.Close();
this.DataGrid1.PageIndexChanged += new
System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.GridPageIndexChanged);
--------------------------------------------------------------------------------------------
Hope someone can help, I'm sure the btnSearch_Click method is where I
need to put the code.
Thanks in advance,
Al