Hello,
I need to have 2 bands for my ultraWinGrid layout. In UltraGrid designer I added band[1] as a child for band[0]. I put ViewStyle property to MultiBand. But on InitializeLayout event I have only one band in e.Layout.Bands collection. What should I add in order to get the second band? (and I need to create the second band at design time, not at run time).
Thank you
Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn1 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("Band 1");
Infragistics.Win.UltraWinGrid.UltraGridBand ultraGridBand2 = new Infragistics.Win.UltraWinGrid.UltraGridBand("Band 1", 0);
this.ugRC.DataSource = this.ultraDataSource1;
ultraGridBand2.MinRows = 1;
this.ugRC.DisplayLayout.BandsSerializer.Add(ultraGridBand2);
this.ugRC.DisplayLayout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.Yes;
this.ugRC.InitializeLayout += new Infragistics.Win.UltraWinGrid.InitializeLayoutEventHandler(this.ugRC_InitializeLayout);
You cannot add bands to the grid. The grid bands come from the data source. The BandSerializer is intended for internal use by the grid only, you should never use this class in your code.
If you are using an UltraDataSource, then you should be adding the bands and setting up the column in the UltraDataSource and then just bind it to the grid.
Thank you for the answer. Could you refer me to some example how to do this? Thanks.
I have a question about binding multiple bands to a wingrid.
I have the following data structure:
3 bands of data (datatables within a dataset really) all with the exact same columns. For simplicity, I'll call them Parent_Band, Child_Band and Other_Band. As you might guess, the Child_Band is a sub-band of the Parent_Band. I established a data relation within my dataset between these two tables, and they are displaying properly when the dataset is bound to the grid. The parent rows are displaying and have expansion indicators if there are child rows. The child rows are displayed beneath the appropriate parent row.
My problem is that I want to then display all the rows from the Other_Band at the bottom of the grid. Although, this band has the same columns, it should have no "relation" to the other bands and the rows should display as "peers" of the Parent Band. They would never have a child band.
I attempted to accomplish this by adding a third table to the dataset and hoping that they would show up somewhere in the grid, but the records from the Other_Band don't display at all. The other bands continue to display correctly.
Any advice would be greatly appreciated.
Thanks so much,
Steve
Hi Steve,
The grid cannot display sibling bands at the root level. You can have sibling child bands. So one row in the grid can display multiple sets of child bands from different tables. But the root level of the grid can only have a single data source.
So you have a couple of options. You could create another table in your DataSet with two rows and then arrange it such that all of the rows in Parent_Table are under one row and all of the rows in Other_Table are under the other row.
Another option would be to use UltraWinTree instead of UltraWinGrid. The tree lacks some of the features of the grid, like summaries and filtering. But it's a little more flexible in terms of the data structure. You would still need two rows (nodes) at the root level to divide up the Parent_Table and Other_Table data. But these rows would not need to be part of the data structure, you could just add a couple of nodes to the tree and then bind their child nodes to different tables.
I am using ultrawindatasource for my hieachical grid, and the reason for using the grid is that I need to be able to merge columns.
The problem I am experiencing is that the last row that I have added doesn't appear in the grid, everything else appears perfectly.
Sorry I mispoke, the rows appear, but the contents and columns are non-existent.
However I am stepping throught the code to add them.
Any ideas?
It's hard to say what's going on here as there's not much to go on. You should probably submit a sample to Developer Support.
-Matt
Hi !
I have a very simple dataset with 2 tables... and just a relation, Parent-child.
The datasource contains the 2 tables and if I look the relation i'm able to see it..
when I assign the dataset at datasource property,I manage the settings grid about InitializeLayout.
And here happens the error : The controls havent 2 bands !
And if i look inside Band Members i see (All = 1... ) and the table current is the child table .
At the end of this speech...seems like that a table isn't loaded into the bands... into ultragrid.
And this is the code..
It's crash 'cause the table parent isn't in datasource's grid but when i assign via code
mygrd.datasource = mydataset (in dataset i have really 2 tables with 1 relation)!
private void ultraGridRilievi_InitializeLayout(object sender, InitializeLayoutEventArgs e) { try { string s = ultraGridRilievi.DisplayLayout.Bands[0].Key; ultraGridRilievi.DisplayLayout.Bands[0].Columns["NomeGruppo"].Hidden = false; ultraGridRilievi.DisplayLayout.Bands[0].Columns["Misura"].Hidden = false; ultraGridRilievi.DisplayLayout.Bands[0].Columns["Documento"].Hidden = true; ultraGridRilievi.DisplayLayout.Bands[0].Columns["GruppoRilievo"].Hidden = true; ultraGridRilievi.DisplayLayout.Bands[1].Columns["Documento"].Hidden = true; ultraGridRilievi.DisplayLayout.Bands[1].Columns["Nome"].CellActivation = Activation.AllowEdit; ultraGridRilievi.DisplayLayout.Bands[1].Columns["ObjIDRilievo"].Hidden = true; ultraGridRilievi.DisplayLayout.Bands[1].Columns["GruppoRilievo"].Hidden = true; } catch (System.Exception er) { MessageBox.Show("Error in ultraGridRilievi_InitializeLayout " + er.Message); } }
any idea ?
of course the grid is multiband..
ok...I find it...so answer to myself...
forgot datamember Initialization...mygrid.datamember = "myparentTable"...
bla bla bla.. ;)