User (Old forums)MemberJune 20, 2005 at 10:45 amPost count: 23064
Or at least it seems I’m missing something easy…
Here’s all I’m doing (dg is an Xceed Grid)
Row dr = dg.CurrentRow;
//…code cut out – this section clears and re-fills the grid’s datasource
dg.CurrentRow = dr;
All I want to do is reset the datasource, but maintain the visual row location. This code (unsurprisingly) doesn’t work… as soon as I clear the datasource the row ‘dr’ is no longer considered to be in the grid. I realize that it is feasible that this row wouldn’t exist or would have a different index after the database update, but for this app that’s not an issue.
So the easy question is this… How do I just get the index of the current row (not the row object)? Or if that is not possible, is there some other way to maintain the scrolling/visual location of a row after resetting the datasource?
Imported from legacy forums. Posted by samnet (had 4006 views)User (Old forums)MemberJune 20, 2005 at 11:12 amPost count: 23064
The <b>DataRow</b>-class has a read-only <b>Index</b>-property. So you can get it, if the CurrentRow is a DataRow, like this:<code>int index = -1;
Xceed.Grid.DataRow dr = dg.CurrentRow as Xceed.Grid.DataRow;
if (dr != null) index = dr.Index;
if (index >= 0 && index < dg.DataRows.Count)
dr = dg.DataRows[index];
dg.CurrentRow = dr;
Imported from legacy forums. Posted by Tommy (had 291 views)User (Old forums)MemberJune 20, 2005 at 11:16 amPost count: 23064
Thanks Tommy, I knew there was a simple answer.
Imported from legacy forums. Posted by samnet (had 396 views)User (Old forums)MemberAugust 19, 2005 at 11:19 amPost count: 23064
That only works when you have only datarows. What about when there is a mix? I currently have groupmanagerrows throughout the grid, a valuerow at the top of the grid and the rest are datarows.
Why isn’t there an absolute row index for every row no matter the type and how can this be done with the above scenario?
Imported from legacy forums. Posted by random0000 (had 342 views)User (Old forums)MemberSeptember 7, 2005 at 3:53 pmPost count: 23064
Any answer on this one?
Imported from legacy forums. Posted by random0000 (had 238 views)User (Old forums)MemberSeptember 8, 2005 at 2:24 amPost count: 23064
Well, you should then probably have to keep multiple variables that indicate what the current row was. If the current row is a row that is not databound (ValueRow) you can keep that row in a variable and use it back later. But databound rows (DataRow, GroupManagerRow) are built and destroyed dynamically, so for those rows you have to use some other technique, like I’ve demonstrated (row-index).
Imported from legacy forums. Posted by Tommy (had 4818 views)
- You must be logged in to reply to this topic.