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
1365
Binding the ultragrid (win) to a seperate control
posted

hi, i want to setup a parent-child relationship between a listbox and the ultragrid (win). I just want to be able to click on an item in the list and see its' details in the grid.

i've added the two tables to the dataset, created a relationship and added it. yet i'm not having the realtime filtering happen. what am i doing wrong?

this is my code for the parent listbox (of dates) which displays correct values. if you ask why i'm not using bindingsource for the grid it's because it yielded no results. here, i'm able to see the data in the grid as well. any help or tips would be greatly appreciated.

        BindingSource bsDates = new BindingSource();
            bsDates.DataSource = m_ds;
            bsDates.DataMember = "SNAPSHOT_DATES";  //name of table in ds
            lstBackupDates.DataSource = bsDates;
            lstBackupDates.DisplayMember = "snapdatedime";
            lstBackupDates.ValueMember = "snapdatedime";

ultraGridSnapshots.DataSource = m_ds;
            ultraGridSnapshots.DataMember = "SNAPSHOTS"; //name of table in ds

 DataRelation drSnapdate = new DataRelation("Snapdatetime",
                m_ds.Tables["SNAPSHOT_DATES"].Columns["SNAPDATEDIME"],
                m_ds.Tables["SNAPSHOTS"].Columns["SNAPDATEDIME"],
                false);
            m_ds.Relations.Add(drSnapdate);

  • 1365
    Verified Answer
    posted

    sorry, i found the answer . just wasn't binding correctly. correct code is here. the child binding was not right.


                BindingSource bsDates = new BindingSource();
                bsDates.DataSource = m_ds;

               bsDates.DataMember = "SNAPSHOT_DATES";
                lstBackupDates.DataSource = bsDates;
                lstBackupDates.DisplayMember = "snapdatedime";
                lstBackupDates.ValueMember = "snapdatedime";

                
                BindingSource bsRows = new BindingSource();
                bsRows.DataSource = bsDates;        <================= datasource object above, not child table.
                bsRows.DataMember = "Snapdatetime"; <================ name of datarelation object
                ultraGridSnapshots.DataSource = bsRows;