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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SelectedRecord changed returns wrong value

Thread ID:





88804 Aug 12,2009 01:58 PM UTC Sep 5,2009 06:35 AM UTC WinForms 5
Tags: GridControl
Santosh U
Asked On August 12, 2009 01:58 PM UTC


I have a GGC which has List of the Products. On selecting particular product from the grid I am populating its details and showing it in a edit form. I am facing a problem giving different record then what is expected.
Here is my code below.

private void gridGroupingControl1_SelectedRecordsChanged(object sender, SelectedRecordsChangedEventArgs e)
if (e.SelectedRecord != null && e.SelectedRecord.Record.Kind != DisplayElementKind.AddNewRecord)
//int productid = Convert.ToInt32(e.SelectedRecord.Record.GetValue("PRODUCT_ID").ToString());
int productid = Convert.ToInt32(gridGroupingControl1.Table.CurrentRecord.GetValue("PRODUCT_ID").ToString());
catch (OverflowException oex)

When I debug first of all this gets called twice (I agree since one record gets defocused and another gets it).
But finally when it returns me the product ID it returns me the previous records id.
This happens when I instead of clicking and selecting the record I use UP and DOWN key of the keyboard. One more thing I have noticed that it returns different record for e.SelectedRecord and ggc.Table.CurrentRecord. One more weired thing is that this happens when I use UP key rather than DOWN Key.

Please let me know if I am doing anything wrong or there is something else.

Santosh U

Jisha Joy [Syncfusion]
Replied On August 13, 2009 09:14 AM UTC

Hi Santhosh,

In GridGroupingControl,you could get the selected records by just looping through the Table.SelectedRecords collection. See the code:

// For GridGroupingControl

foreach(SelectedRecord rec in this.gridGroupingControl1.Table.SelectedRecords)

Please let me know if this helps.


Replied On August 14, 2009 01:51 PM UTC

If it is a single select grid then try
Datarow gridRow = ((DataRowView)gridcontrol.Table.SelectedRecords[0].Record.GetData()).Row;
if(null !- gridrow)
int productid = (int)gridrow["productid"];

Santosh U
Replied On August 18, 2009 02:35 PM UTC


I have tried this on GGC but this throws and Index out of range exception. But when i check SelectedRecord it shows me the values.

The issue of showing wrong selected record still persists, Please help.

Santosh U

Santosh U
Replied On August 26, 2009 01:11 PM UTC


Any updates on this please, This is still not having any solution. I tried many work-arounds.

Santosh U

Santosh U
Replied On September 5, 2009 06:35 AM UTC

Hi Jisha,

I simply added this if statement and got the solution.

if (e.Action == SelectedRecordsChangedType.Added)



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon