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.

Type Conversion.

Thread ID:

Created:

Updated:

Platform:

Replies:

14808 Jun 4,2004 01:06 PM Jun 4,2004 04:08 PM Windows Forms 1
loading
Tags: GridControl
kstoj
Asked On June 4, 2004 01:06 PM

I have a GriddataboundGrid control which displays the property of some class in the read only fashion. One property in the class is of type "int" which I would like to display as a string inside the Grid ( Example: 1 - America, 2 - Europe etc. ). I try to decorate the particular property with the: [TypeConverter(typeof(MyConverterClass))] attribute to do the conversion for me. This works for the .NET native controls but in the case of the GridDataBoundGrid the conversion does NOT happend. Does the Syncfusion GridDataBoundGrid use this type of attribute for conversion? What other mechanisms can I employ to do the necessary conversion for me.

Administrator [Syncfusion]
Replied On June 4, 2004 04:08 PM

I will have to check to see whether the typeconverter attribute should be picked up by our grid. One way you can do this is create a DataTable with 2 columns, DisplayMember and ValueMember (or create an arraylist of objects where the object have properties DisplaMember and ValueMember). For the displaymember, use the text you want to see. For the valuemember, set the integer value. You can then set GridStyleInfo style = this.grid.Binder.InternalColumns["Col1"].StyleInfo; style.DataSource = MyDataTable; //or arraylist style.DisplayMember = "DisplayMember"; style.ValueMember = "ValueMember"; style.ShowButtons = GridShowButtons.Hide;

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.

;