Hi,
I'm able to getText of a cell in the band[0] but I'm not able to find a way to getText of a cell in the band[1] of my ultraWebGrid.
When I'm trying to get the cell of the band zero I type:
cell = UGrid_Dispatch.Rows[i].Cells[j];
String text = cell.GetText();
but I don't see how to do the same with the band[1]...
Can someone give my a snippet of code for doing that?
Thank for your help.
Fiodor.
You need to know where in your hierarchy exists the row you're after, including a reference to each of its parent rows - all the way up to the root row in band 0. Each row has a collection of its own child rows.
For instance, say you want to loop through all rows within bands 0 and 1 of a grid. The following JavaScript would be your basic setup:
// Assume that "grid" is a reference to your WebGrid instancevar rowCount0 = grid.Rows.length;for (var i = 0; i < rowCount0; i++){ var row0 = grid.Rows.getRow(i); // Do something with the band 0 rows here var rowCount1 = row0.ChildRowsCount; for (var j = 0; j < rowcount1; j++) { var row1 = row0.getChildRow(j): // Do something with the band 1 rows here }}
The getChildRow() method is one way of getting at the child rows of a particular parent row. It iis likely one of the "cleaner" approaches, from the perspective that it's relatively consice and easy-to-read.
But could you show me how can I make this in C#, because I don't use js?
Fiodor
I have an ultragridview with 2 bands. How do I get the text of a cell from the second band with in GV_InitializeRow event? Hope you can help!
I'm using ASP.NET.
Thanks,
Thai
Thank you a lot.
Certainly.
In C#, this is easier, since each UltraGridRow object has its own Rows collection to represent its child rows. We can also take advantage of statements such as "foreach" that don't have direct counterparts in JavaScript.
Below is C# code that is roughly equivalent to the JavaScript code I posted earlier:
using Infragistics.WebUI.UltraWebGrid;...foreach (UltraGridRow rowInBand0 in grid.Rows){ // Do something with the band 0 rows here foreach (UltraGridRow rowInBand1 in rowInBand0.Rows) { // Do something with the band 1 rows here }}