?
Solved

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

Posted on 2006-10-26
5
Medium Priority
?
557 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1600 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 400 total points
ID: 17824935
You could have used:
//Bind to datagrid
   this.dgEquipment.SetDataBinding(dv, "");

I think.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month8 days, 10 hours left to enroll

764 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