Hi,
I use an UltraDataSource and i modify his content programmatically and i can see the changes in the UltraGrid but how can i change the appearance depending on the change of the source?
Thank you,
Kind Regards.
Just stick a variable in the initialize layout method that lets you run two layouts:
Private Sub mygrid_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles mygrid.InitializeLayout
if datasource1= true then
'run this initialize layout
else
End Sub
Thank you for the response but i don't think it's the good answer (my english is quiet poor, i tried my best to explain my problem lol...)
The problem is that the grid is associated with an UltraDatasource but i don't use "Databind" fonction
i only manipulate the DataSource :
I create the schema like this :
With Me.DataSource.Band.Columns ' Add columns to the root band. .Add("col1", GetType(String)) .Add("col2", GetType(String))
End With
'create a row from code
Me.DataSource.Rows.SetCount(Me.DataSource.Rows.Count + 1) Dim row As UltraDataRow 'Get the new row. row = Me.DataSource.Rows(Me.DataSource.Rows.Count - 1) row("col1") = "data" row("col2") = "data"
this code works, the ultradatasource generate the row and data are modified, we can see any modifications in the ultragrid BUT my question is how can i detect that data from a specific row or cell has change so i can change the appearance of the grid ?
If you are just adding or removing columns based on response then you could use the aftercolumnpositionchanged event to fire the code. In any case if you check it out you might find the initialize row fires when you change the column and could just use that code.
No no, the problem is that i add ROWS dynamically (not columns) and i would like to detect (from the grid) any add/delete/update of any content of the rows
For instance :
myDataSource.rows("col1") = newValue
then in the grid, i would like to have an event that notifys me that datas has changed in a specific column/row
is there such a functionality?
Regards.
This might be easier using a Dataset (or DataTable if you only have one table) and BindingSource instead of an UltraDataSource.
DataTables have RowChanged and ColumnChanged events that will notify you when data changes. RowChanged is fired when a row is added/removed and when data in the row changes (it tells you which of these has happened).
ColumnChanged is fired when an individual value is changed. It gives you the column and row that has changed and the new value.
Regards,
John.
this is correct! :) (but it is vertical :D)
Thank you very much!
Child rows show up underneath their parent rows by default.
If they are displaying to the right of the parent row, then you must have set the ViewStyleBand on the grid to Horizontal.
hi guys,
THAT IS SO COOL! I used the BindingList(of object) and that suits perfectly !
Thank you so much! ;)
I still have another question, my object A contains a list of object B so the grid "understands" that it is a childband but it displays horizontally
how can i displays the childband (list of object B) under the Parent Row?
Kind regarsds.
Thank you for your advices, that makes sense using bindingsource, i'm not comfortable yet by using bindingSource but i read articles about INotifyPropertyChanged
Maybe that is the solution, let me try some sample, i will give you feedbacks asap.
Once again, thank you.
Kind regards.
John is correct. A DataTable has built-in support to keep track of the changes to the data so that it can work with the DataAdapter and update the back end.