View previous topic :: View next topic |
Author |
Message |
sprugh Guest
|
Posted: Fri Jan 27, 2006 10:49 pm Post subject: Simple Programtic Dataset Example Doesn't work |
|
|
I am currently evaluating Virtual Tree and I cannot get a basic sample using an untyped Dataset from a stored procedure to work.
I dropped the tree on a form. Added one column colEventGroupName.
Added one data binding:
DataRow(EventGroup)
->colEventGroupName(Field=group_name)
Now, at runtime, I call the stored procedure and bind like this:
AdoHelper helper = AdoHelper.CreateDefaultHelper();
DataSet notifyDS = helper.ExecuteDataset("notification_ret_all");
notifyDS.Tables[0].TableName="EventGroup";
this.m_notificationTree.DataSource = notifyDS;
But the tree only shows this:
System.Data.DataSet
->System.Data.DataViewManagerListItemTypeDescriptor
I'm assuming I'm clueless, but this is pretty basic. What am I doing wrong?
Thanks,
-Scott |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Sun Jan 29, 2006 10:58 pm Post subject: |
|
|
The problem is that you haven't created any RowBindings that define how the bound data should be mapped to rows and columns. If you set your data source at design time then a default set of columns and RowBindings can be generated automatically for you - however since you are setting the data source at runtime this is not done (because there is no way to save the design time information).
You can either:
A. Define a design time dataset, set it as your data source and then auto generate the bindings and columns. This is often the quickest and easiest approach even if ultimately you want to set the data source programmatically at runtime.
B. Define the required RowBindings manually using the Virtual Tree editor. For a DataSet you need to add a DataSet binding, a DataView binding and DataRow bindings for each of the tables you want to display. For the DataRow bindings you need to set the TableName property and the Field property for each CellBinding.
See the section in the online help on "Data Binding to ADO.NET Datasets and DataViews" for more information _________________ Infralution Support |
|
Back to top |
|
|
sprugh Guest
|
Posted: Mon Jan 30, 2006 4:32 pm Post subject: Simple Programtic Dataset Example Doesn't work |
|
|
Ok. I get it.
I have to add a DataView binding. Then, I set the DataSource to be the DataTable not the DataSet. This seems to work.
Thanks,
-Scott |
|
Back to top |
|
|
|