This is a migrated thread and some comments may be shown as answers.

Column values not displayed properly when binding to a DataSet or custom objects

1 Answer 27 Views
Grid
This is a migrated thread and some comments may be shown as answers.
immitev
Top achievements
Rank 1
immitev asked on 01 Dec 2008, 01:23 PM
I have a grid that binds to hierarchical objects in the Load() handler of a ascx control:

 grid.MasterTableView.DataSource = masterTable; // a table from a typed DataSet
  grid.MasterTableView.DetailTables[0].DataSource = childTable; // a table from a typed DataSet

The grid.DataBind() is called later.

The grid has defined a bunch of bound columns using GridBoundColumn (Name, Description, etc.). The hierarchy gets displayed correctly (there are parent/child rows), but the values of the columns are always "System.Data.DataRowView" and this does not make sense, since the tables contains the rows Name, Description... I have inspected in debug mode the items in ItemDataBound event and they seem OK.

I tried an alternative implementation with binding to objects, but I am getting similar results - I jsut have the class name displayed instead of "System.Data.DataRowView" .

Any ideas? Is the binding problematic or something else?

1 Answer, 1 is accepted

Sort by
0
immitev
Top achievements
Rank 1
answered on 01 Dec 2008, 01:39 PM
Well, I forgot to set DataField to the GridBoundColumn - no wonder it did not show any data
Tags
Grid
Asked by
immitev
Top achievements
Rank 1
Answers by
immitev
Top achievements
Rank 1
Share this question
or