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

Assignment to GridControl cell''s Tag property is not ''sticking''

Thread ID:





91737 Nov 30,2009 07:03 PM UTC Dec 10,2009 09:45 AM UTC WinForms 6
Tags: GridControl
Sean Greer
Asked On November 30, 2009 07:03 PM UTC

I have a strange problem - the following code results in the cell's Tag property being null. The reference "cmc" is not null, and the assignment results in the Tag being null. Has anybody seen something like this?

for(int n = 0; n < this.m_MessageList.Count; n++)
CalendarMessageContext cmc = this.m_MessageList[n];
int rndx = this.m_Grid.RowCount;
this.m_Grid[rndx, 1].Tag = cmc;
// .Tag is null!
// other code snipped.

Sean Greer
Replied On November 30, 2009 11:22 PM UTC

Alright, I seem to have found the problem. The base class CalendarMessageContext implements ICloneable and returns the result of a virtual Cloning method. If not overridden, then null is returned. It appears that the grid will clone the object being assigned to the Tag property.

Can I have my 2 hours back?

Lingaraj S [Syncfusion]
Replied On December 2, 2009 08:57 AM UTC

Hi Sean,

Thank you for your interest in Syncfusion products.

I am afraid that I am unable to reproduce the issue in GridControl when the Object cloneable object is assigned to tag property. I have created a simple sample to test the issue Also I have attached the sample in below link:

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=Grid Control1856631662.zip

Please have look at the above sample and if you still face the issue. Please try to reproduce the issue in above sample, that could be helpful for us to analyze the issue and give a better solution.

Lingaraj S.

Sean Greer
Replied On December 9, 2009 12:08 AM UTC

When I attempt to download your sample project, I get "Bad Request".

I'm attaching my sample project that shows that when the object reference being assigned to the Tag property on a cell implements IClonable and returns null from the Clone implementation, the Tag property is set to null.

I'm sorry that the project is not completely straightforward, but I was trying several things to figure out why the Tag was null. I finally found that it was the IClonable issue.

Just run the solution in Visual Studio 2008 with the 7.402.0.20 Essential Studio components. You'll hit a breakpoint in the form's OnLoad when the assignment to the .Tag property occurs and then one in the implementation of IClonable.Clone when null is returned. The end result is that you'll see that the Tag property is null.



Lingaraj S [Syncfusion]
Replied On December 9, 2009 10:56 AM UTC

Hi Sean,

Thank you for the update.

By default, the Tag property is taken the Cloneable object. If you don't want to store the Cloneable object in Tag property, then please try using GridStyleInfoStore.TagProperty.IsCloneable property to achieve your requirement as shown below code.

protected override void OnLoad(EventArgs e)
GridStyleInfoStore.TagProperty.IsCloneable = false;
// Other codes ...

Please let me know if you have any queries.

Lingaraj S.

Sean Greer
Replied On December 9, 2009 07:35 PM UTC

Very good! Thanks for updating me that this is the standard behavior and now that I know of the property, I'll be able to make it work as I'd like.

Thanks again!

Lingaraj S [Syncfusion]
Replied On December 10, 2009 09:45 AM UTC

Hi Sean,

Thank you for the update and using Syncfusion products.

Please let me know you have any queries.

Lingaraj S.


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

or the page will be automatically redirected to 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