Hi All,
I have a grid which displays thousands of rows.I want to select all rows on a button click.I used the following approach. But it takes lot of time .
{
}
Can anybody suggest me an alternative which is faster?.
Thanks
Abja
Hi,
here is what I do:Private Sub ugTableGrid_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ugTableGrid.ClickDim mainElem As Infragistics.Win.UIElement = Me.ugTableGrid.DisplayLayout.UIElementDim mousePos As Point = Me.ugTableGrid.PointToClient(Control.MousePosition)Dim elem As Infragistics.Win.UIElement = mainElem.ElementFromPoint(mousePos)Dim Header As BandHeader = NothingIf elem IsNot Nothing Then If elem.GetAncestor(GetType(RowSelectorHeaderUIElement)) IsNot Nothing Then Header = TryCast(elem.GetContext(), BandHeader) End IfEnd IfIf Header IsNot Nothing Then Me.ugTableGrid.Selected.Rows.Clear() SelectChildBandRows(Me.ugTableGrid.Rows, Header.Band.Key)End IfEnd Sub
As you can see I am geting the BandHeader from the context. But the BandHeader doesn't supports the sibling rowscollection.
Your suggestions don't work :(
TryCast(elem.GetContext(), RowsCollection) -> Returns Nothing&TryCast(elem.GetContext(), UltraGridRow) -> Returns Nothing
I'm pretty sure you can get the rows collection from the UIElement using the GetContext method.
GetContext is a method on the UIElement class which tried to get some real object that is related to the UIElement itself.
What UIElement are you using?
Try passing in a type of RowsCollection, or maybe UltraGridRow. If either of those returns non-null, that should give you a link to the collection of rows you want to select.
I have an UltraGrid whose RowSelectorHeaderStyle is set to SeparateElement.The UltraGrid has one root band and some child bands.
I implemented the selection of all rows in a band by clicking the BandHeader's element.Is it possible to select only all sibling rows of a child band by clicking the BandHeader? I don't know how to get the sibling rows collection when you just have the BandHeader...
There's a KB article on this: HOWTO:What is the best way to programmatically select all rows in the grid?
Thanks for your reply.It was really helpful.I required to cast objects to objects of Rows array .
grdEmpMessage.Selected.Rows.AddRange((UltraGridRow[) grdEmpMessage.Rows.All);
Thanks,