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.
Unfortunately, activation email could not send to your email. Please try again.

Getting 'NULL' Element

Thread ID:

Created:

Updated:

Platform:

Replies:

118944 Apr 27,2015 08:55 AM Apr 29,2015 03:38 AM Windows Forms 3
loading
Tags: GridGroupingControl
Rasika
Asked On April 27, 2015 08:55 AM

Hello,
I am using gridgrouping Control
I used element to get record.
But sometimes I got Null element when I clicked on the gridgrouping control row which gives me error for further code.
So is there any other way to get record?

Regards,
Rasika

Solai A L [Syncfusion]
Replied On April 28, 2015 02:20 AM

Hi Rasika,

Thank you for your interest in Syncfusion products.

We have analyzed your reported scenario. In order to get the record from a GridGroupingcontrol, you can use GridTableCellStyleInfo. Before fetching the record details using GetRecord, a validation is need to ensure the clicked cell is a record and the display element is not equal to null(this would resolve your problem of null reference exception).Please refer the below provided KB ,code snippet and sample for further clarification.

Code Snippet[c#]:

void gridGroupingControl1_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e)

{

GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);

GridTableCellStyleInfoIdentity id = style.TableCellIdentity;

if (id.DisplayElement!=null && id.DisplayElement.Kind == DisplayElementKind.Record)//this is to validate whether the cell click is done only in value cells and not in headers/Caption row/anyother.

{

Record rec = id.DisplayElement.GetRecord();

MessageBox.Show("RowIndex is:" + rec.Id.ToString()); //Real RowIndex

}

}

Sample:

http://www.syncfusion.com/downloads/support/forum/118944/WindowsFormsApplication21_(2)755905147.zip

KB Link:

http://www.syncfusion.com/kb/4275/how-can-i-identify-a-record-from-the-gridstyleinfo


Note: If still your issue is not resolved. Please provide us a step by step replication procedure or replicate in the above provided sample and send back to us. So, that it would be easy for us to provide a prompt solution as early as possible.


Please let us know if you have any other concerns.


Thanks & Regards,

AL.Solai.


Rasika
Replied On April 29, 2015 02:14 AM

Hello,
Thank You so much for the reply.
Its working fine.Thanks a lot.

Regards,
Rasika

Solai A L [Syncfusion]
Replied On April 29, 2015 03:38 AM

Hi Rasika,

 

Thank you for your update.

 

We are glad to know that your issue has been resolved. Please let us know if you need any further assistance in future.

 

Thanks & Regards,

AL.Solai.


CONFIRMATION

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.

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.

;