Hi All,
I have a win grid with a max of 5000 rows at any given point of time. So the user will select a row on the grid and hit on the tool bar which invokes a winform. when the user x out of the form, the grid will be refresh automatically by getting a datasource from sql. But after the refresh I want the same row to be highlighted/selected and if the row # is say 4999, i want the scroll bar to navigate to that row automatically, so that the row is right now visible. Can we achieve this? This makes the user's life easy.
And by the way the grid has a column which is like primary key.
Thanks in advance.
Swetha.
Hi,
Intellisense in VB.Net has a problem with Equals, because it gets confused between the Equals enum value and the Equals method on object.
But even though it doesn't show up in Intellisense, it is there and it still works if you just type it in.
Hi Torrey/Mike,
I tried using the filter operand
Dim filter As Infragistics.Win.UltraWinGrid.FilterCondition = New Infragistics.Win.UltraWinGrid.FilterCondition(Infragistics.Win.UltraWinGrid.FilterComparisionOperator.NotEquals, miActivityId)
But I dont see Equals in the List of operators. I see code from other developers using it. If i type in Equals, it is auto correcting to NotEquals. Was this deprecated / made it internal.
Thanks!
The best thing to do is: don't set the DataSource on the grid. Update the existing data source with what you need without completely destroying everything and re-creating from a new data source.
But, of course, that's not always feasible.
String primary_key = "suroor0@adventure-works.com";FilterCondition filter = new FilterCondition(FilterComparisionOperator.Equals, primary_key);ultraGrid1.Rows.ColumnFilters["EmailAddress"].FilterConditions.Add(filter); UltraGridRow our_row = ultraGrid1.Rows.GetFilteredInNonGroupByRows()[0];ultraGrid1.Rows.ColumnFilters.ClearAllFilters();ultraGrid1.ActiveRow = our_row;
String primary_key = "suroor0@adventure-works.com";FilterCondition filter = new FilterCondition(FilterComparisionOperator.Equals, primary_key);ultraGrid1.Rows.ColumnFilters["EmailAddress"].FilterConditions.Add(filter);
UltraGridRow our_row = ultraGrid1.Rows.GetFilteredInNonGroupByRows()[0];ultraGrid1.Rows.ColumnFilters.ClearAllFilters();ultraGrid1.ActiveRow = our_row;
Place the primary key value into a variable when the user clicks that button on the toolbar to invoke the dialog you've created. When that gets closed, use the code above as your reference to get that row selected again.
It's a little hack, but something different than looping like Mike always suggests (possibly faster??).
Mike,
You are right. Is there any efficient way that you suggest?
Do you think after binding the data source to the grid and looping through the rows to find the PK value in a grid having 5000 rows is efficient?
Or should I use Initialize Row to get the Row Index and then later actiivate the row?