Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Filter datagrid from combobox
Message
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01607611
Message ID:
01607626
Views:
34
>Hi all , it's been a long time since I've done anything with ADO.NET relations so bear with me, I have a dataset with two tables - client and invoices, I've added a relation to the dataset on the common fields 'clientid' with client being the parent table and invoices the child. What I'm tring to do is show the clients in a combobox and filter their invoices to be shown in a datgridview when the combobox selection changes. The combobox has it's datasource set to the clients table and the datagridview has it's datasource set to the invoices table. What I'm getting is all invoices shown no matter what is selected in the combo.
>
>This is how I set the relation and the datasource of the datagrid and combo.
>
>this.dsInvoiceData.Relations.Add("ClientInvoices",this.dsInvoiceData.Tables["clients"].Columns["clientid"],
>this.dsInvoiceData.Tables["invoices"].Columns["clientid"]);
>
>this.cboClients.DataSource = this.dsInvoiceData.Tables["clients"];
>this.cboClients.DisplayMember = "companyname";
>this.cboClients.ValueMember = "clientid";
>
>this.dgInvoices.DataSource = this.dsInvoiceData.Tables["invoices"];
>
>
IIRC, you should use a DataGridView and filter that. Something like this (but change the filter on the ComboBox SelectedItemChanged event):
http://www.codeproject.com/Tips/431281/Filter-DataGridView-with-the-text-entered-in-TextB
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform