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

saving grid data

Hi, I have some GridHierDataBoundGrids that allow the user to select new values from combo boxes or edit cell contents. I know this is probably a very basic question, but how can I save this data to the grid''s data source? The data comes from an xml data source. Thanks, CB

9 Replies

AD Administrator Syncfusion Team January 30, 2004 06:25 AM UTC

Are you populating a DataSet with the XML data using DataSet.ReadXml? If so, you would use DataSet.WriteXml to resave the file. If you are doing something else, you would have to do the ''WriteXml'' analog of whatever ''ReadXml'' technique you used.


AD Administrator Syncfusion Team January 30, 2004 02:50 PM UTC

Okay, Thanks, WriteXml is working for the grid except for a combox that I added. The combo does not retain its value when I switch to a new row or when I save to the datasource. I''m sorry for the simple question, but I am totally new to this grid control and a bit confused. I added a combo box style cell to the grid. The combo needs to read and write it''s value from the same data source as the rest of the grid but it''s dropdown list needs to be a choicelist. Here is the code I wrote for the combo. Can you tell me what property I am neglecting to set? Dim Items As New StringCollection() Items.Add("Masculine") Items.Add("Feminine") Items.Add("Neuter") style = CType(e.Grid, GridDataBoundGrid).GridBoundColumns ("Gender").StyleInfo style.CellType = "ComboBox" style.DataSource = Items style.DropDownStyle = GridDropDownStyle.Exclusive Thanks so much! CHuck >Are you populating a DataSet with the XML data using DataSet.ReadXml? If so, you would use DataSet.WriteXml to resave the file. > >If you are doing something else, you would have to do the ''WriteXml'' analog of whatever ''ReadXml'' technique you used.


AD Administrator Syncfusion Team January 30, 2004 03:02 PM UTC

Instead of: style = CType(e.Grid, GridDataBoundGrid).GridBoundColumns ("Gender").StyleInfo style.CellType = "ComboBox" style.DataSource = Items style.DropDownStyle = GridDropDownStyle.Exclusive try style = CType(e.Grid, GridDataBoundGrid).GridBoundColumns ("Gender").StyleInfo style.CellType = "ComboBox" style.ChoiceList = Items style.ExclusiveChoiceList = True


AD Administrator Syncfusion Team January 30, 2004 04:56 PM UTC

Thanks again, that worked great. The only problem I''m having now is that when I switch to a different row in the parent grid of the one that has the combo, the combo does not save the value I picked. Thanks, Chuck >Instead of: > > >style = CType(e.Grid, GridDataBoundGrid).GridBoundColumns ("Gender").StyleInfo >style.CellType = "ComboBox" >style.DataSource = Items >style.DropDownStyle = GridDropDownStyle.Exclusive > > >try > >style = CType(e.Grid, GridDataBoundGrid).GridBoundColumns ("Gender").StyleInfo >style.CellType = "ComboBox" >style.ChoiceList = Items >style.ExclusiveChoiceList = True >


AD Administrator Syncfusion Team January 30, 2004 08:58 PM UTC

Is something ReadOnly? Your grid columns style, or the whole grid, or the datatable or something else ??? Can you reproduce this problem in one of the ComboBoxes in the Syncfusion\Essential Suite\Grid\Samples\CellTypes\ComboboxCells sample? Can you prepare a little sample project showing this problem and post it here, or submit a Direct Trac support incident and include the sample project there?


AD Administrator Syncfusion Team January 31, 2004 07:55 PM UTC

No, nothing is readonly. I looked into the problem more and found that the combo switches back to the value of the original record rather than the value I selected from the picklist whenever I click on the record selector of the parent grid. The original value is not one of the selections from the picklist- maybe this is the problem? For example: the record has the value ''unknown'', next I choose ''choice one'' from the picklist, next I click on the record selector of the parent grid and then go back to the child grid and combo and the combo is set back to ''unkown''. It doesn''t matter whether or not I move to a different record. If I avoid clicking the record selector the new value is saved. I could not reproduce this behavior with the sample. Any ideas? I really stuck and I have to get this project done soon. Thanks so much! Chuck >Is something ReadOnly? Your grid columns style, or the whole grid, or the datatable or something else ??? > >Can you reproduce this problem in one of the ComboBoxes in the Syncfusion\Essential Suite\Grid\Samples\CellTypes\ComboboxCells sample? > >Can you prepare a little sample project showing this problem and post it here, or submit a Direct Trac support incident and include the sample project there?


AD Administrator Syncfusion Team January 31, 2004 10:45 PM UTC

If you are setting style.ExclusiveChoiceList = True, then the value in the grid cell should in the comboboxes choice list. Can you prepare a sample project showing the problem and post it here? Or create a Direct Trac support incidence, and post a sample there.


AD Administrator Syncfusion Team February 2, 2004 04:46 PM UTC

Hi, Thanks for your help. I''ve attached a sample project showing the issue. To reproduce: 1. Open second grid in hierarchy, 2. go to dropdown called ''gender'' 3. select a value from the dropdown list 4. click on record selector of parent grid or go to the next record in the 2nd grid 5. return to first record in second grid and check to value of gender dropdown - you will note that it reverted back to its original value rather than saving the change you made I really appreciate the help! Also can you give me an example of some code to create a dropdown list type of cell that is sorted in descending order by the last column? I will also be looking at the syncfusion samples for this info! Chuck >If you are setting style.ExclusiveChoiceList = True, then the value in the grid cell should in the comboboxes choice list. > >Can you prepare a sample project showing the problem and post it here? Or create a Direct Trac support incidence, and post a sample there. > > Test2104_8220.zip


AD Administrator Syncfusion Team February 2, 2004 05:10 PM UTC

Hi, Here is the data file to test with. You need to store in at C:\ Thanks again, Chuck >Hi, > >Thanks for your help. I''ve attached a sample project showing the issue. To reproduce: > >1. Open second grid in hierarchy, >2. go to dropdown called ''gender'' >3. select a value from the dropdown list >4. click on record selector of parent grid or >go to the next record in the 2nd grid >5. return to first record in second grid and check to value of gender dropdown - you will note that it reverted back to its original value rather than saving the change you made > >I really appreciate the help! Also can you give me an example of some code to create a dropdown list type of cell that is sorted in descending order by the last column? I will also be looking at the syncfusion samples for this info! > >Chuck > >>If you are setting style.ExclusiveChoiceList = True, then the value in the grid cell should in the comboboxes choice list. >> >>Can you prepare a sample project showing the problem and post it here? Or create a Direct Trac support incidence, and post a sample there. >> >> > >Test2104_8220.zip > > Data_8447.zip

Loader.
Live Chat Icon For mobile
Up arrow icon