sgidman
asked on
c# dataview as a binding source
I have a common DataTable that i vish to display in various different ways in different datagridviews. It would appear that the best way is to use separate dataviews based on the datatable for each binding source for each DGV.
What I need to know is how to get the data table column names from the binding source
if the binding source is a datatable the following works
foreach (DataColumn Col in (cmbMCCB.Binding.DataSourc e as DataTable).Columns)
If the binding source is a dataview this does not work nor does
foreach (DataColumn Col in (cmbMCCB.Binding.DataSourc e as DataView)[0].Row.Table.Col umns)
Any ideas
What I need to know is how to get the data table column names from the binding source
if the binding source is a datatable the following works
foreach (DataColumn Col in (cmbMCCB.Binding.DataSourc
If the binding source is a dataview this does not work nor does
foreach (DataColumn Col in (cmbMCCB.Binding.DataSourc
Any ideas
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I solved it by using
foreach (DataColumn Col in ((System.Data.DataView)cmb MCCB.Bindi ng.DataSou rce)[0].Ro w.Table.Co lumns)
Thanks for your help
foreach (DataColumn Col in ((System.Data.DataView)cmb
Thanks for your help
DataTable1.DefaultView
Are you aksing this?