This is a migrated thread and some comments may be shown as answers.

CultureInfo in the edit mode of RadGridView

1 Answer 214 Views
GridView
This is a migrated thread and some comments may be shown as answers.
MJ14
Top achievements
Rank 1
MJ14 asked on 13 May 2010, 06:14 PM

I have a GridViewTextBoxColumn in RadGridView. The column honors CultureInfo during display, however when it goes into the edit mode, the RadBoxTextEditor inside the cell, doesn't honor culture info. This is true with any column - GridViewTextBoxColumn or GridViewDecimalColumn.

We want the editor to show same culture info as the grid. How can set the editor to have same cultureinfo...

I am using following during grid intialization but it is not working.

private void radGridAdjustments_Initialized(object sender, EventArgs e)

 

 {

 

 

radGridAdjustments.Columns.Add(

 

 

new GridViewTextBoxColumn("AdjAmount"));

radGridAdjustments.Columns[

"AdjAmount"].FieldName = "AdjAmount";
radGridAdjustments.Columns["AdjAmount"]).FormatInfo = CultureInfo.CurrentCulture

 

radGridAdjustments.Columns["AdjAmount"].FormatString = "{0:c}";

radGridAdjustments.Columns[

"AdjAmount"]).FormatInfo.NumberFormat.CurrencyDecimalDigits = 2;
}

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 18 May 2010, 12:15 PM
Hello MJ14,

You can't localize the text editor because it just displays the value which is set to it. However, you can use the CellEditorInitialized event to customize this value. Here is a sample:

void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    RadTextBoxEditor editor = this.radGridView1.ActiveEditor as RadTextBoxEditor;
    if (editor != null)
    {
        editor.Value = string.Format("{0:c}", int.Parse((string)this.radGridView1.CurrentCell.Value));
    }
}

I hope this helps.

Greetings, Jack
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
MJ14
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or