Hojoformo
asked on
Datagrid bind problem - Cannot create a child list (C# / windows.net)
I am working on a windows.net application and having problem binding to a datagrid. I believe it has something to do a child relationship, if so, how can I remove the relationship before binding?
An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll
Additional information: Cannot create a child list for field tblEquipmentInventory.
//Initalize dataset.
this.ds.Clear();
this.ds.AcceptChanges();
//Get data from tables tblEquipmentInventory, facility, customer...)
this.ds = this.bizObj.FilterByScenar io(this.ds Customer, this.lbscenario.Text.ToStr ing(), nchCustomerID.ToString());
string expression = "EquipmentColA = 1";
DataView dv = ds.Tables["tblEquipmentInv entory"].D efaultView ;
//Only get rows ColA = 1
dv.RowFilter = expression;
this.dgEquipment.DataSourc e = dv;
//Bind to datagrid
this.dgEquipment.SetDataBi nding(dv, "tblEquipmentInventory")
An unhandled exception of type 'System.ArgumentException'
Additional information: Cannot create a child list for field tblEquipmentInventory.
//Initalize dataset.
this.ds.Clear();
this.ds.AcceptChanges();
//Get data from tables tblEquipmentInventory, facility, customer...)
this.ds = this.bizObj.FilterByScenar
string expression = "EquipmentColA = 1";
DataView dv = ds.Tables["tblEquipmentInv
//Only get rows ColA = 1
dv.RowFilter = expression;
this.dgEquipment.DataSourc
//Bind to datagrid
this.dgEquipment.SetDataBi
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that was it. interesting, can not bind dataviews to a grid. I do not understand but it works.
> interesting, can not bind dataviews to a grid
Yes, you can, but the SetDataBinding arguments are (DataSource, DataMember). and tblEquipmentInventory is not a valid member of it's own default view.
David
Yes, you can, but the SetDataBinding arguments are (DataSource, DataMember). and tblEquipmentInventory is not a valid member of it's own default view.
David
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Which line thru this exception?