Hi guys
Sorry if I raise a very commonly asked question, but I spent the whole day searching the net and your forums and still found nothing on my issue.
I have a three-level hierarchical grid (UltraGrid), I need to get cell values from the second and third grid bands.
I can fetch the data from the first level grid without any issues, but when I need to go one or two levels deeper, it gets rather tricky.
Could you give me an example how do one fetches data from hierarchical grids over the multiple layers, please?
Eugene,
MsgBox SwfWindow("Form1").SwfTable("ultraGrid1").GetCellData("0;0;2","Quantity")
In a case where you have a grid with three levels this code would display the value in the "Quantity" column of the third row in the first child row of the first row in the grid. In other words, the third row of Band[2] in the grid.
Thanks Michael!
How could I refer to the sub-level grid as an object? Say, for example, to the mentioned third level grid?
I'm not sure I understand what you are asking. Band[2] is the third level of the grid's hierarchical data. Is that what you mean?
Hi Michael,
I am facing the problem as below.
I am want to use one of my Ultragrid private control from one of my unit tests project.
I am trying to create one Ultragrid control at runtime, where as after binding Datasource i should get UltraGrid.Rows.Count > 0.
where as i am getting row count is 0. no idea why its happening. can you please check and let me know what is wrong with below code.
//Create a table that will contain three columns.Infragistics.Win.UltraWinGrid.UltraGrid tempUltraGrid = new Infragistics.Win.UltraWinGrid.UltraGrid();DataTable table = new DataTable("Table");
//Create three columns that will hold sample data.DataColumn ApplicationInfo = new DataColumn("ApplicationInfo", typeof(string));DataColumn ApplicationName = new DataColumn("ApplicationName", typeof(string));DataColumn Description = new DataColumn("Description", typeof(string));DataColumn Version = new DataColumn("Version", typeof(string));DataColumn Type = new DataColumn("Type", typeof(string));DataColumn FileName = new DataColumn("FileName", typeof(string));DataColumn Default = new DataColumn("Default", typeof(string));
//Add the three columns to the table.table.Columns.AddRange(new DataColumn[] { ApplicationInfo, ApplicationName, Description, Version, Type, FileName, Default });
//Add the table to the dataset.dsgridSource.Tables.Add(table);dsgridSource.Tables[0].Rows.Add(new object[] { "ApplicationInfo", "ApplicationName1", "Description1", "Version1", "Type1", "FileName1", "Default1" });tempUltraGrid.DataMember = "Table";tempUltraGrid.DataSource = dsgridSource;
tempUltraGrid.DisplayLayout.Rows[0].Selected = true; -----Getting error at this line
Error information is :"Index was outside the bounds of the array."
please let me know whatz wrong in the above code
-Hari
Did that suggestion work for you?
Hari,
OK, I didn't realize you were never adding your grid to a Form. That makes a big difference. Evidently if the grid is not added to the Controls collection of a Form (and the Form is shown), the grid will have no BindingContext. You can get around this by setting the BindingContext of the grid to the BindingContext of the Form, (or setting it to a new BindingContext). I have attached a new version of the sample application which does this so you can see how it works.
It is probably not a good idea to not add the grid to a Form because you can have a potential memory leak. Why are you not adding the grid to a Form? If you don't want to see the grid you can set its Visibility to false. Anyway, I hope this is helpful.
what ever the code you gave is worked fine, but you just comment following one line of code you could see the same error as below.
//this.Controls.Add(tempUltraGrid); tempUltraGrid.DisplayLayout.Rows[0].Selected = true;
"Index was outside the bounds of the array."
I have attached a new version of the sample application. This one was built using Visual Studio 2008 with NetAdvantage 2008 volume 3. It seems to work fine. Take a look at it and let me know what you think.
If you are using NetAdvantage 2008 volume 3 then you should use the Version Utility to downgrade my sample project to 8.3 You will also have to change it to CLR2. You should also clear out any text in the licenses.licx file.