Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataGrid question
Message
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00718287
Message ID:
00718303
Views:
20
One trick that I know is the ability to create joins among DataTables in your DataSet. The one trick I know to do this is to us a DataRelation and an expression-based column to simulate a join. If you have DataTable objects for customer and order information, you can create a relationship between the two DataTable objects and then add an expression-based DataColumn in the orders DataTable to display a column from the customers DataTable:
ds.Relations.Add(“CustomersOrders”, 
ds.Tables[“Customers”].Columns[“CustomerID”], 
ds.Tables[“Orders”].Columns[“CustomerID”];
ds.Tables[“Orders].Columns.Add(“CompanyName”, typeof(string),
          “Parent(CustomersOrders).CompanyName”);
>In a datagrid, I want to be able to display a description from a 'foreign' table.
>
>Let's say I retrieve 2 tables from SQL Server...the first table contains customer ID codes, and the second contains a customer master list. (I'm relating the two resulting datatables in an ADO.NET relation).
>
>In the grid, I'm mainly showing the results of the first table, but the last column needs to be the 'related' customer name from the second table.
>
>If I were doing a combobox in the grid, I know how to use DisplayMember, ValueMember, etc. The problem is that these properties don't seem to be available for a DataGridTextBoxColumn.
>
>So...if I'm using a DataGridTextBoxColumn, how do I specify a column from a 'child' table?
>
>Thanks,
>Kevin
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform