We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridDataBoundGrid selected row

Is there any way to find out the currently selected DataRow/DataRowView in the gdbg?

8 Replies

AD Administrator Syncfusion Team May 30, 2005 03:44 PM

Try this code. CurrencyManager cm = grid.BindingContext[grid.DataSource, grid.DataMember] as CurrencyManager; DataRowView drv = cm.Current as DataRowView;


MC Martin Cyr May 31, 2005 08:02 AM

Great!!!! Thanks for info. Can''t tell you how satisfied I am with SyncFusion support :) Keep on truckin'' >Try this code. > >CurrencyManager cm = grid.BindingContext[grid.DataSource, grid.DataMember] as CurrencyManager; >DataRowView drv = cm.Current as DataRowView; >


MC Martin Cyr May 31, 2005 08:45 AM

Little followup now. Can I get the next/previous row without moving the cursor? >Great!!!! Thanks for info. > >Can''t tell you how satisfied I am with SyncFusion support :) > >Keep on truckin'' > >>Try this code. >> >>CurrencyManager cm = grid.BindingContext[grid.DataSource, grid.DataMember] as CurrencyManager; >>DataRowView drv = cm.Current as DataRowView; >>


AD Administrator Syncfusion Team May 31, 2005 08:52 AM

The cm.List will be the DataView, and you can index it to get at any of the DataRowView objects (though you will have to make sure the indexes are proper values which the code below does not worry about). CurrencyManager cm = grid.BindingContext[grid.DataSource, grid.DataMember] as CurrencyManager; DataView dv = cm.List as DataView DataRowView nextDrv = dv[cm.Position + 1];


MC Martin Cyr May 31, 2005 09:47 AM

I just ran in another problem when trying to use the information you provided in http://www.syncfusion.com/Support/forums/message.aspx?MessageID=29524. If I understand correctly, I could color a precise cell/row/col at this moment, but I need something slightly more fancy. I need to choose the color according to a value in the corresponding DataRow/View, but the currency manager doesn\''t seem to be synchronized. Still I could access the cell containing the color wich I wanna use, but obviously, this is a no-no since I don\''t want to show this column to the user. Any ideas?


AD Administrator Syncfusion Team May 31, 2005 10:03 AM

Use the cm.List and retrieve the DataRowView within PrepareViewStyleInfo so you can test the value you want to test. See the response in 29524.


SS Sharad Sharma June 29, 2005 04:05 AM

Can we drag and drop this selected row(s) within the GridDataBoundGrid. Thanks. >Try this code. > >CurrencyManager cm = grid.BindingContext[grid.DataSource, grid.DataMember] as CurrencyManager; >DataRowView drv = cm.Current as DataRowView; >


AD Administrator Syncfusion Team June 29, 2005 04:17 AM

If you are using a DataTable/DataView as the DataSource of the GridDataBoundGrid, then you will not be able to easily move rows. The reason is that a sorted dataview will not let you change row-order as it actively maintains teh proper sort order. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=31033

Loader.
Live Chat Icon For mobile
Up arrow icon