Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
UltraTree with DataBind is duplicating data
posted

I have an UltraTree set up with DataBinding.

The DataSet is one table, which is self-referencing for its heirarchy.  Each record has an "ID" field and a "ParentId" field.

I've set up the DataSet like this:

_level1DataSet.Tables.Add(GetTable("Level1"));
            _level1DataSet.Relations.Add("Active", TreeViewItems.Tables["Level1"].Columns["id"], TreeViewItems.Tables["Level1"].Columns["parent_id"], false);

private DataTable GetTable(string tableName)
        {
            try
            {
                var selectCommandText = string.Format(SELECT_COMMAND_TEMPLATE, tableName);
                var dataAdapter = new OleDbDataAdapter(selectCommandText, this.OleDbConnection);
                var table = new DataTable(tableName);
               
                dataAdapter.Fill(table);
                return table;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error getting data");
            }

            return null;
        }
        
private const string SELECT_COMMAND_TEMPLATE = "SELECT display_name, orig_display_name, id,parent_id, item_type, item_state, item_link, doc_seq FROM [{0}]";

I reference the DataSet thus:

ppTreeView.Override.ShowExpansionIndicator = ShowExpansionIndicator.CheckOnDisplay;
ppTreeView.DataSource = propelDataSource.TreeViewItems;

I also have set up InitializeDataNode to manipulate the records, and if needed I can provide that code (but I don't believe the issue to be there).

When the data is displayed, I'm getting the following result:

In the above picture, the folders are showing properly at the top (under "root").  However, the folders seem to be repeating themselves on the same level as root, and they shouldn't be there.  

I've verified that the dataset accurately reflects the data located in the database.  The documents that are also on the root level belong there - just the folders are extra.

What could be causing this?

Parents Reply Children
No Data