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

GridStyleInfo''s DataSource property

Are there be any known difficulties in binding a GridStyleInfo to a non-traditional data source - something other than a dataset or dataview? I have a class with some properties that I would like to display in a grid row but I''m having some troubles hooking the binding up using the DataSource, ValueMember properties of the GridStyleInfo object... model[1, 3].DataSource = searchCriteria; model[1, 3].DisplayMember = "BindProperty"; model[1, 3].ValueMember = "BindProperty"; model[1, 3].CellValue = searchCriteria.BindProperty;

4 Replies

Administrator September 21, 2004 07:01 PM UTC

To further clarify, the property in my datasource doesn''t change as the values in the grid cell change. I also added an event handler to the grid''s SaveCellInfo event and I noticed that the "Handled" property of the event args was false - if that''s any help. >Are there be any known difficulties in binding a GridStyleInfo to a non-traditional data source - something other than a dataset or dataview? >I have a class with some properties that I would like to display in a grid row but I''m having some troubles hooking the binding up using the DataSource, ValueMember properties of the GridStyleInfo object... > >model[1, 3].DataSource = searchCriteria; >model[1, 3].DisplayMember = "BindProperty"; >model[1, 3].ValueMember = "BindProperty"; >model[1, 3].CellValue = searchCriteria.BindProperty;

Administrator September 21, 2004 07:59 PM UTC

Is searchCriteria some kind of IList or IListSource object? If not, the above code will not work. Also, you would have to be using a GridControl, and not a GridDataBoundGrid for such code to work.

Administrator September 21, 2004 08:10 PM UTC

It is a GridControl but, no, the object I''m trying to use as a datasource is not a list. I guess the best way to deal with "binding" is getting/retrieving the values during an event (CurrentCellChanged probably?) Thanks Clay.

Administrator September 21, 2004 11:18 PM UTC

You could use the QueryCellInfo event to dynamically provide the e.Style.CellValue for a particular cell from your data cache, and then use SaveCellInfo to move any modified value from e.Style.CellValue back to your data cache.
Loader.
Live Chat Icon For mobile
Up arrow icon