How to add a filtering capability to a gridview which is populated by a stored procedure
Posted on 2008-11-07
I have a standard AJAX toolkit for .NET framework 2.0 gridview which gets populated by a stored procedure. My database connection uses a connection string from the web.config.
Could you give me a step-by-step on how to add the filter row in the header of the gridview, and hook up the filtering capability to the gridview's data population?
When the page loads I call this:
public DataTable GetJobStatus(string JobName)
DataSet ds = new DataSet();
DbCommand dbCommand = _database.GetStoredProcCommand("proc_CD_Web_GetJobStatus");
_database.AddInParameter(dbCommand, "JobName", DbType.String, JobName);
ds = _database.ExecuteDataSet(dbCommand);
When a page loads or a row is deleted or added, I call UpdateGrid() which calls the above to get the datatable and binds that datatable to the gridview.
I'm confused as to how I hook up this filtering capabilitying into my existing process. I guess I have to add each column as a parater into the stored proc, then add all of them as parameters into each function? How do I get the searched for text from the gridview to the code behind?
It's urgent. Really appreciate your help!