I have a applyfilter that works with another page (using this sample http://www.c-sharpcorner.com/Blogs/B...spx?BlogId=825). can similar be implemented with following datasource (following datasource is for child gridview). I have a label where user will input a value for filter. i like to take that value and implement it with the code i posted so that the childgrid now have filtered data. hope it makes sense. (see example here: http://www.codeproject.com/KB/aspnet...dGridView.aspx ) please suggest.
Code:
private DataTable ChildDataSource(string strlpID, string strSort) { SqlConnection conn; SqlDataAdapter daProducts; DataTable dsProducts; string strQRY = ""; conn = new SqlConnection(@"Server=riverstone; Integrated Security=SSPI; Database=nw"); strQRY = "SELECT [Orders].[CustomerID],[Orders].[OrderID]," + "[Orders].[ShipAddress],[Orders].[Freight],[Orders].[ShipName] FROM [Orders]" + " WHERE [Orders].[CustomerID] = '" + strlpID + "'" + "UNION ALL " + "SELECT '" + strlpID + "','','','','' FROM [Orders] WHERE [Orders].[CustomerID] = '" + strlpID + "'" + "HAVING COUNT(*)=0 " + strSort; daProducts = new SqlDataAdapter(strQRY, conn); dsProducts = new DataTable(); daProducts.Fill(dsProducts); return dsProducts; }
Comment