Assignment to GridControl cell''s Tag property is not ''sticking''
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.
}
SIGN IN To post a reply.
6 Replies
SG
Sean Greer
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?
LS
Lingaraj S
Syncfusion Team
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.
Regards,
Lingaraj S.
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.
SG
Sean Greer
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.
Thanks!
GridTagTest_edcb026b.zip
LS
Lingaraj S
Syncfusion Team
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.
Please let me know if you have any queries.
Regards,
Lingaraj S.
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.
SG
Sean Greer
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!
LS
Lingaraj S
Syncfusion Team
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.
Regards,
Lingaraj S.
Thank you for the update and using Syncfusion products.
Please let me know you have any queries.
Regards,
Lingaraj S.
SIGN IN To post a reply.
- 6 Replies
- 2 Participants
-
SG Sean Greer
- Nov 30, 2009 07:03 PM UTC
- Dec 10, 2009 09:45 AM UTC