Hi,
I'm using UltraConrolContainerEditor.
I want to assign values of child band to nested grid, so each row will display related child band in the cell row.
I added unbound column to parent grid and set the data type of the column to IList.
I've tried to assign the values of the child band to the cell.
However I'm having problem with picking those values by nested grids. (have two grids for rendering and editing control)
Can I get some example on that?
Thanks,
s
I will be happy to asist you with your inquiry.
I am not sure what you mean by "assigning values of child band to nested grid". May I ask if you can provide me with additional details, including a screenshot, of what you are looking to accomplish with the UltraGrid?
I am looking forward to hearing from you.
Thank you very much for your reply.
What I am looking for is to display the child band inside the cell of the parent grid.
I want to achieve that by using UltraControlContainerEditor.
I have a parent grid and two other grids that I assign to UCCEditor as an editing and rendering controls.
Each row of my parent grid have a child band with different values and different number of rows.
So I want to get the child band values and assign it as a DataSource to those two grids.
Any help will be appreciated.
Thank you,
What you are trying to do here is not a simple thing, and there are a number of challenges you will need to overcome.
First off, the ControlContainerEditor needs to deal with a single value. The WinGrid is not really designed to deal with a single value - it deals with a data source that can have many values in many rows and columns. In this case, the only thing that makes sense would be for the to use the grid's DataSource. So you need a grid column where the value of every cell is some object that is suitable as the DataSource for child grid.
There is no such object that exists in the parent grid. So you would need to somehow generate a DataTable or a BindingList<T> that contains the child data.
The second challenge you will have is updating. You mentioned that you are assigning both an EditingControl and a RenderingControl and they are both grids. So does that mean you want the user to be able to edit the child grid data? If so, it's not going to work automatically, because the ControlContainerEditor will be looking for an event that fires when the property on the EditingControl changes. In this case, that property is the DataSource, and the grid does not fire any kind of DataSourceChanged event when you edit a cell within the grid. So you will need to handle these notifications yourself in order to tell the parent grid that something has changed.
Anyway, if this is something you want to pursue, I could probably help you work through these issues, but just be aware that this is not a trivial undertaking. And even if you can get all of this to work, performance might be a problem. In order to render a cell that is not in edit mode, the ControlContainerEditor has to set the property (DataSource in this case) on the RenderingControl and then paint that control into the cell. This happens often - every time the cell paints. So every time you scroll the parent grid or move the mouse over the child grid cell, you will be assigning and a new datasource to the RenderingControl grid many many times. Even with a very small set of data in the child grid, this will be extremely performance-intensive.
Thank you for your reply.
If that approach would affect the performance badly I would prefer to achieve it in different way. (as I do care for performance)
I mentioned the EditingControl as I want to have in those two grids the button which user could click to access another form.
Would then be better if I display a child band columns and rows in a cell as it was describe in this thread: http://es.infragistics.com/community/forums/p/16488/397151.aspx#397151
However I'm not that clear how to populate multi-rows of child band into the cell of the parent grid.
Regards,
In the link you have here, the developer was copying a single value from the child row into the parent row. There's no way to put multiple values into the same cell in the grid. A grid cell has only one Value. Of course, that Value could be an object which contains more than one piece of information. But then we are right back where we started - using a single control to display multiple rows in an efficient way.
What kind of assumptions can you make about the child data here? Do you know the maximum number of child rows / columns?
If you just want to display the data in the cell and allow a separate dialog for editing, then maybe you could create a simple UserControl with some TextBoxes that displays the data and is more efficient than using a WinGrid (which has a whole lot of functionality you won't be using).
It's also possible that I am wrong about the performance, but the only way to tell would be to implement it and test it. And like I said, it's not a trivial implementation, so it could be a lot of work for something that ultimately isn't feasible.
Hello,
I want to go ahead with the ControlContainerEditor and two grids.
I have a DataTable with child band values. The values in the DataTable are changing for each parent row.
I populate two grids on InitializeRow event of the parent grid.
But the problem I am facing now is that I overwrite values of the grids with the newly populate DataTable.
And I want to display specific child band values for each parent row.
What to do to not to overwrite the values?
I display 8 cells in the parent grid and 3 cells in the child grids.
I have more cells in child grids but i'm hiding them, I've loaded them all once and it loaded fine as well.
The performance is fine for now, it does not freeze or anything like that. (know more about that as I go on with testing)
Thank you again,
Great. Just out of curiosity, how many cells are visible at once in the main grid and how many cells in the child grid in the cell?
And how's the performance?
Thank you so much it is working now and doing what I was looking for!
Your guidance Mike helped me to understand better UltraControlContainerEditor, UltraGrid and of course to solve mine problem.
So just quick summary what I have:
In 'ParentGrid_InitializeLayout':
Me.UltraControlContainerEditor1.RenderingControl = Me.Grid1Me.UltraControlContainerEditor1.EditingControl = Me.Grid2
UltraControlContainerEditor1.RenderingControlPropertyName = "DataSource" UltraControlContainerEditor1.EditingControlPropertyName = "DataSource"
Me.ParentGrid.DisplayLayout.Bands(0).Columns("UnboundColumn").EditorComponent = Me.UltraControlContainerEditor1
In ParentGrid_InitializeRow:
e.Row.Cells("UnboundCell").Value = MyDataTable
And works like a charm!
Well, one obvious missing piece here is the EditingControlPropertyName / RenderingControlPropertyName. By default, the ControlContainerEditor will try to link up the cell's Value with the Value property of the EditingControl (which the WinGrid does not have). Then it looks for Text, so it's probably setting the Text property of your grid to a DataSet - or trying and failing to do so.
You need to set these to "DataSource", since that's what you want to set on the child grid.
What I do is in 'ParentGrid_InitializeLayout' I set:
Me.UltraControlContainerEditor1.RenderingControl = Me.Grid1 Me.UltraControlContainerEditor1.EditingControl = Me.Grid2 Me.ParentGrid.DisplayLayout.Bands(0).Columns("UnboundColumn").EditorComponent = Me.UltraControlContainerEditor1
and then in ParentGrid_InitializeRow:
but the cell remains blank.
What am I missing?