Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
862 | Aug 26,2002 12:40 PM UTC | Aug 28,2002 08:08 AM UTC | WinForms | 6 |
![]() |
Tags: GridControl |
gridDataBoundGrid1.Binder.InternalColumns[1].StyleInfo.CellType = "CheckBox"; //col 2
gridDataBoundGrid1.Binder.InternalColumns[3].StyleInfo.CellType = "CheckBox"; //col 4
CurrencyManager cm = (CurrencyManager) this.BindingContext[this.gridDataBoundGrid1.DataSource];
cm.Refresh();
To be updatable, the datasource has to implement IBindingList, and an arbitary ArrayList does not do this. We will look into add some type of IBindingList support for allowing an ArrayList to be updatable.
However, it would be simple to use the GridControl control in a virtual mode and bind your arraylist through handling QueryCellInfo. Take a look at the Virtual Grid Tutorial which steps you through the 3 events you would need to handle. Then to make the arraylist updatable, you handle SaveCellInfo to move the edited values back into your array list. Even though you are handling 4 events, it only requires a couple of lines of code in each event. It is straight forward. In one event, you provide the colcount, in another you provide the rowcount, in another you get the value, and in the last you set the value. This is straight-forward way of binding arbitrary datasources to a grid. The only requirement of the datasource is that its has to be able to provide a value for cell given its row and column. Thats it. And if you want teh datasource updatable, it has to be able to accept a changed value for a a specified row and column.
If you want to attach a file, we can take a look at what you are trying to do. But I suspect that the problem has to do with the missing interfaces necessary to make a IList updatable.
-Clay
gridDataBoundGrid1.BeginUpdate();
gridDataBoundGrid1.DataSource = al;
gridDataBoundGrid1.TableStyle.CheckBoxOptions.CheckedValue = Boolean.TrueString;
gridDataBoundGrid1.TableStyle.CheckBoxOptions.UncheckedValue = Boolean.FalseString;
gridDataBoundGrid1.Binder.InternalColumns[1].StyleInfo.CellType = "CheckBox"; //col 2
gridDataBoundGrid1.Binder.InternalColumns[3].StyleInfo.CellType = "CheckBox"; //col 4
gridDataBoundGrid1.Model.ColStyles[2].CellType = "CheckBox";
gridDataBoundGrid1.Model.ColStyles[4].CellType = "CheckBox";
gridDataBoundGrid1.EndUpdate(true);
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.