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.

I can''t bind two columns to the same field?!

Thread ID:

Created:

Updated:

Platform:

Replies:

67851 Aug 31,2007 06:16 PM Sep 3,2007 09:38 PM Windows Forms 1
loading
Tags: Grouping
Haishi
Asked On August 31, 2007 06:16 PM

I was trying to bind two columns to the same field of my data source and got an error: "Item has already been added. Key in dictionary: 'XXXXAutoSizeMaxLength' Key being added: 'XXXXAutoSizeMaxLength'. XXXX being the name of the field.

What's going on?

Rajagopal [Syncfusion]
Replied On September 3, 2007 09:38 PM

Hi Stanley,

Thanks for your interest in Syncfusion Products.

The reason for this error is because you are trying to add a column that already exists in the TableDescriptor.Columns collection. That is, when you add the column to the TableDescriptor.Columns collection whose mapping name is same as the one in the columns collection. The default behvior in the latest version is to populate the column collection from the datasource and add any new entry to the end of the collection. When you bind two columns of same name to a field, this would result in this exception. Whereas, in older versions before you add anything to the collection, Columns.Clear() will be called internally. To avoid this error, you need to explicitly call the Clear() method before you add columns to the existing collection with same name.

Let me know if you have any other questions.

Regards,
Rajagopal

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.

;