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.

GGC and pulldown box

Thread ID:

Created:

Updated:

Platform:

Replies:

54971 Jan 21,2007 01:57 PM Jan 24,2007 10:07 AM Windows Forms 6
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On January 21, 2007 01:57 PM

Hi,

we are using a GGC to present our data. The grid works really fine. Nevertheless I have got a question about localization and the pulldown box. The column which is presented as a pulldown box is an enum type in our business object. Now I am wondering what's the best or preferred way to handle the localization of this type. I thought about implementing a custom celltype for that column and handle the localization there - is this the best way?

Perhaps you can give me a hint or a small code example what you would suggest.

Thank you very much in advance

Tom

Administrator [Syncfusion]
Replied On January 22, 2007 01:21 PM

Hi Tom,

Please try the attached sample and let me know if you are looking something different.
DropDownCultureInfo.zip

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On January 23, 2007 03:16 AM

Hi Haneef,

thank you for your example, but I think this isn't really what I suggest. I have attached the modified sample so you can see my problem.

First of all the the cell value is not "localized" - i have to click on the cell to see the localized values in the dropdown box. Furthermore if I choose a "localized" value then I get an exception.

Perhaps you can take a look at this ?

Best regards,
Tom

DropDownCultureInfo.zip

Administrator [Syncfusion]
Replied On January 23, 2007 02:47 PM

Hi Tom,

You need to change the CellValueType property of the "Data" column descriptor to "System.String" and also handle the DrawCellDisplay event to display the custom text in a cell. Please refer to the attached sample and let me know if you are looking something different.

Sample : ModifiedDropDownCultureInfo.zip

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On January 24, 2007 03:53 AM

Hi Haneef,

thanks for your sample, the problem with your suggestion is, that if you start the application you see the NOT localized value in each cell. After you have choosen an item from the drop down box, everything is fine. How can I handle the problem during startup?

Thanks in advance

Administrator [Syncfusion]
Replied On January 24, 2007 10:02 AM

Hi Tom,

This is the default behavior of the grid, however to get the desired behavior, you can use DrawCellDisplayText event and set the e.DispalyText to some new value to want to display. Here is a code snippet

void Grid_DrawCellDisplayText(object sender, GridDrawCellDisplayTextEventArgs e)
{
string hashCode = GetHashCode(e.RowIndex,e.ColIndex);
if( DisplayCellValue.Contains(hashCode))
{
e.DisplayText = DisplayCellValue[hashCode].ToString();
}
else
{
for (int i = 0; i < m_Names.Length;i++ )
{
if (m_Names[i].IndexOf(e.DisplayText)>-1)
{
DisplayCellValue[hashCode] = m_Names[i];
e.DisplayText = m_Names[i];
break;
}
}

}
}

Please try the attached sample and let me know if this helps.
ModifiedDropDownCultureInfo.zip

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On January 24, 2007 10:07 AM

Thanks Haneef,

this works fine :-)

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.

;