473,327 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Apply Filter on Child Data Grid

145 100+
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.

Expand|Select|Wrap|Line Numbers
  1. private DataTable ChildDataSource(string strlpID, string strSort)
  2. {
  3. SqlConnection conn;
  4. SqlDataAdapter daProducts;
  5. DataTable dsProducts;
  6. string strQRY = "";
  7. conn = new SqlConnection(@"Server=riverstone; Integrated Security=SSPI; Database=nw");
  8. strQRY = "SELECT [Orders].[CustomerID],[Orders].[OrderID]," +
  9.  "[Orders].[ShipAddress],[Orders].[Freight],[Orders].[ShipName] FROM [Orders]" +
  10.  " WHERE [Orders].[CustomerID] = '" + strlpID + "'" +
  11.  "UNION ALL " +
  12.  "SELECT '" + strlpID + "','','','','' FROM [Orders] WHERE [Orders].[CustomerID] = '" + strlpID + "'" +
  13.  "HAVING COUNT(*)=0 " + strSort;
  14. daProducts = new SqlDataAdapter(strQRY, conn);
  15. dsProducts = new DataTable();
  16. daProducts.Fill(dsProducts);
  17. return dsProducts;
  18. }
Jun 17 '09 #1
1 1544
dorandoran
145 100+
I added parameters and it's seems to be working. however, it breaks when I dont pick anything from the dropdown filter box. my drop down has 30,60 and 90 and "" which is filtered against quantity. so i get "input string was not a correct format" error when i dont select anything from the drop down. I want the parameter to be optional. for example, show all the records when nothing is picked from the dropdown. (filter part is working).
Jun 17 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Otie | last post by:
I have a project with a main form and a second form with a grid on it. Neither form is an MDI, thus neither form is a child - they are two independent forms. The CALCULATE button on the main form...
1
by: muesliflakes | last post by:
I have a Data Set with parent / child related tables and wish to show the parent rows in one data grid and the child rows in another data grid. The problem is that the parent datagrid has the...
2
by: RSB | last post by:
I have three Tables Table1 .. which has Child records in Table2 which further has child records in Table3. Now i was thinking to Have a Datagrid for Table2 and then There should be another...
11
by: Thomas A | last post by:
Hi, I fill a datgrid with data from a xml document, it works fine But.... Now I will to filter the data to the grid so only the data shows from the criteria that I set. My code now is very...
0
by: Manjunath s via DotNetMonster.com | last post by:
Hi, I have two grid G1 and G2 bound to a dataset haveing table d1 and d2 respectively. if I navigate through G1 which is the parent grid the appropriate child records are displayed correctly in...
0
by: Ambica Jain | last post by:
I have a data grid called Files, which has some columns like FileName, Col1, Col2, ... , Col8. Then i have a combobox which allows user to select from Col1 to Col8 and based on this selection, i...
0
by: Innova | last post by:
Hi, We are working on a gridview inside the gridview (parent-child) scenario. The data of child grid will depend on the data of parent. Objectives: 1.Add new row in parent grid after each row...
1
by: kithir | last post by:
Hi, I am working with asp.net.In my webform i have an editable datagrid.I am loading data from the database.I want to enter data for the particular column of the grid.But that grid has more than...
3
by: dbdb | last post by:
hi guys need your suggestion how can i apply filter for my date variable data type i have a form name transaction and i have a text box on it named : start and finish i need to apply...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.