Solved

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

Posted on 2006-10-26
5
542 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
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…

707 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