Showing posts with label number of rows. Show all posts
Showing posts with label number of rows. Show all posts

Tuesday, April 21, 2009

Finding Number of Rows in UltraGrid

Hi friends
Today i was working on Ultra Grid provided by
Infragistics. I found out a typical problem. There is a scenario where i have to find the number of rows selected in the grid. These number of rows are not by selecting the check boxes in the grid cell but by CTR-Click combination. i can check the activated row by the active index properties but now i have to select all the rows which i have previously selected with the holding the control button. Below is the code which might be helpful for you.


public ArrayList GetSelectedAccount(Infragistics.Win.UltraWinGrid.UltraGrid dgAccount)
{
ArrayList AccountArray = new ArrayList();
CurrencyManager cmAccount = (CurrencyManager)this.BindingContext [dgAccount.DataSource, dgAccount.DataMember];
DataView dvAccount = (DataView)cmAccount .List;
for (int i = 0; i < dvAccount .Count; ++i)
{
if (dgAccount.Rows[i].Selected)
{
AccountArray.Add(dgAccount.Rows[i].Cells["AccountID"]);
}
}
messagebox.show(AccountArray.length.tostring());
}
[/CODE]