Solved

Datagrid bind problem - Cannot create a child list  (C# / windows.net)

Posted on 2006-10-26
5
546 Views
Last Modified: 2008-02-01
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.FilterByScenario(this.dsCustomer, this.lbscenario.Text.ToString(), nchCustomerID.ToString());
  string expression = "EquipmentColA = 1";
  DataView dv = ds.Tables["tblEquipmentInventory"].DefaultView;
//Only get rows ColA = 1
  dv.RowFilter = expression;
  this.dgEquipment.DataSource = dv;
//Bind to datagrid
   this.dgEquipment.SetDataBinding(dv, "tblEquipmentInventory")
0
Comment
Question by:Hojoformo
  • 2
  • 2
5 Comments
 
LVL 13

Expert Comment

by:dungla
ID: 17816843
Hi Hojoformo,

Which line thru this exception?
0
 
LVL 13

Accepted Solution

by:
dungla earned 400 total points
ID: 17816855
Hi there,

Try to remove this line:

//Bind to datagrid
   this.dgEquipment.SetDataBinding(dv, "tblEquipmentInventory");
0
 

Author Comment

by:Hojoformo
ID: 17818393
that was it.  interesting, can not bind dataviews to a grid.  I do not understand but it works.
0
 
LVL 11

Expert Comment

by:anyoneis
ID: 17824921
>  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
0
 
LVL 11

Assisted Solution

by:anyoneis
anyoneis earned 100 total points
ID: 17824935
You could have used:
//Bind to datagrid
   this.dgEquipment.SetDataBinding(dv, "");

I think.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now