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.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

91737 Nov 30,2009 02:03 PM Dec 10,2009 04:45 AM Windows Forms 6
loading
Tags: GridControl
Sean Greer
Asked On November 30, 2009 02:03 PM


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];
this.m_Grid.RowCount++;
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 06:22 PM


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 03:57 AM

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.

Regards,
Lingaraj S.

Sean Greer
Replied On December 8, 2009 07:08 PM


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.

Thanks!



GridTagTest_edcb026b.zip

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

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;
base.OnLoad(e);
// Other codes ...
}


Please let me know if you have any queries.

Regards,
Lingaraj S.

Sean Greer
Replied On December 9, 2009 02:35 PM


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 04:45 AM

Hi Sean,

Thank you for the update and using Syncfusion products.

Please let me know you have any queries.

Regards,
Lingaraj S.

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.

;