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
195
DataTable control Binding issue
posted

Hi

I have problem with UltraTextEditor (and other Infra UI components building)

1. Component bound to same DataTable column (eg Name on below example) do not update
    Expected behavior - leaving tbName and focusing (eg tbCity) should result displaying same value in tbName2

2. Change made in components are not reflected in DataTable bound to eg dataGridView
    Expected behavior - leaving (moving focus) from currently edited control should update dataTable / grid

Cant believe this is Infra bug, I must be doing something wrong - appreciate your help here !

Below is sample app code and screen how it works

           DataTable dt = new DataTable();

           dt.Columns.Add("Name");
            dt.Columns.Add("City");


            tbName.DataBindings.Add ( "Value", dt, "Name",true, DataSourceUpdateMode.OnPropertyChanged);
            tbName2.DataBindings.Add( "Value", dt, "Name",true, DataSourceUpdateMode.OnPropertyChanged);
            tbCity.DataBindings.Add( "Value", dt, "City",true, DataSourceUpdateMode.OnPropertyChanged);


            // New row
            dt.Rows.Add ( dt.NewRow() );

            dataGridView1.DataSource = dt;

  • 29085
    Offline posted

    Hello Maciej, 

    Regarding the UltraGrid, how are you leaving edit mode and when does the cell not update? Are you clicking to another control?

    When an UltraWinGrid cell is in edit mode, the changes are not written to the underlying data until the cell exits edit mode. You can force the grid to exit edit mode if you are calling UpdateData and there is a chance the grid still has the focus. You can do this using PerformAction. 

    UltraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode)
    UltraGrid1.UpdateData()