We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GDBG and DataView problem

Hi, Having a GDBG, data set and AutoLabel, I''m doing the following: 1. Set the data set as the data source of the grid. 2. Bind "Text" property of the label to one of the columns in the data table. When running the app, when selection in the grid is changed, the binding causes to the label value to change as well. till now everything works fine. The problem begins, when I wrap the data table with data view, and assigns the data view as the data source of the grid. the label is still bound to the same column in data table. Now, the binding doesn''t seem to work. When selection in the grid is made, the label is not updated. Why this is happening? How can I use data view with GDBG and still use the binding? Attached to this message is a sample project I wrote which demonstrats the problem. Please response A.S.A.P Thanks, GilK P.S. I''m using syncfusion version 2.1.0.9 DataViewSample_9600.zip

1 Reply

AD Administrator Syncfusion Team December 30, 2004 11:54 AM UTC

In order for two databound controls to remain in sync, they must be using the same BindingContext. When you make the grid use a new DataView, it no longer uses the original bindingcontext to the datatable. So, you have two options. You can let the grid use datatable.DefaultView which is the default bindingcontext of the label. Or, you can let the grid use a new dataview, but also change the label to use the same dataview. private void button1_Click(object sender, System.EventArgs e) { DataView dv = new DataView(myTable1.Tbl1); gridDataBoundGrid1.DataSource = dv; autoLabel1.DataBindings.Clear(); autoLabel1.DataBindings.Add("Text",dv,"name"); }

Loader.
Live Chat Icon For mobile
Up arrow icon