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
close icon

Bind a windows textbox to gridDataBoundGrid

Hello, I have a simple problem, but no idea how I can solve it... I have a Form with a DataSet, some textfields and combo boxes and a GridDataBoundGrid placed in a GridRecordNavigationControl. All components are bound to the DataSet. My problem is, if I select a row in the grid, I expect that the data in the textboxes will change too. Or, if I type in new data into a textbox, the grid will updated automaticly. Any idea how I can get this behavior without programming to much (I have a lot of Form to design...)? You could see a picture of my form in the zip file. Thank you, Oliver Moss grid_5733.zip

1 Reply

AD Administrator Syncfusion Team January 22, 2004 09:29 AM UTC

Here is a little sample. The only code written in the sample is: 1) Fill the DataSet. 2) Make sure the BindingContext property for each of the bound controls are the same. If you have a multiple panels and groupboxes, this might take a few lines unless you come up with a scheme to do this is some kind of loop. The problem is that the default behavior of most controls is to inherit the bindingcontext from its parent. This means the grid''s binding context will come from the gridrecordnavigationcontrol, and if your textboxes are in a particular groupbox or panel, they will have some other bindingcontext. If this is the case, you do not see the textboxes change as you move in the grid. In the sample, the textboxes are all on the form. So the sample just sets the grid''s bindingcontext to that of the form''s. This makes all the controls use the form''s bindingcontext, and things stay in sync as you move. 3) Handle ColumnChanged on the the DataTable to redraw the grid cell so it will show the new data when the user leaves a textbox. 4) Handle CurrentAcceptedChange on the grid to force the grid to save the change even if you do not move off the grid row. The default behavior is to cache all the changes on a row, and only save them when the user leaves the row.

Loader.
Live Chat Icon For mobile
Up arrow icon