How to Populate DataGrid with the desired form of information.
-
Friday, August 03, 2012 11:38 AMI have an object 'a' of class A that has string attributes and a list of objects of class B. Class B has string attributes c and d.
Object a is to be used as a DataSource for a DataGrid.
I want to populate the Grid with the value 'c', but the grid shows type of B."Is there a way to display c without having to recurse through all the objects?- Moved by Bob ShenMicrosoft Contingent Staff Friday, August 17, 2012 10:42 AM (From:Visual C# General)
All Replies
-
Friday, August 03, 2012 11:50 AM
Hi,
Ste the a.ListOfB property as Itemsource to the DataGrid, so you can bind the properties of B classes to the columns.
-
Friday, August 03, 2012 11:51 AM
to bind the DataGrid, object a must be a DataTable or DataSource. So you can populate object a with c values from object B, e.g. fill object a with obj_b.value_c.
by d way, how are you going to fill object a before binding it to datagrid?
regards
joon
- Marked As Answer by Ashutosh Chaturvedi Friday, August 24, 2012 3:43 AM
-
Friday, August 17, 2012 10:42 AM
Hi Ashutosh,
You are more likely to get more efficient responses to ASP.NET issues at http://forums.asp.net where you can contact ASP.NET experts.
Bob Shen [MSFT]
MSDN Community Support | Feedback to us

