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

GridViewMaskedTextBoxColumn Display

2 Answers 136 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 22 Jun 2010, 03:36 AM
When editing the column it uses the mask as expected but when displayed within the column it uses the raw un-masked value. How do I use a mask for both display and editing?

2 Answers, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 23 Jun 2010, 10:17 AM
Hello Marc,

 The GridViewMaskedTextBoxColumn uses the RadMaskedTextBox to provide its functionality, it does not contain any masking logic on its own.

I would suggest you to subclass the GridViewMaskedTextBoxColumn and override the CreateCellElement method to call the CreateCellEditElement method and customize the RadMaskedTextBox it returns to make it non-editable and show it:

public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
{
    RadMaskedTextBox textbox = (RadMaskedTextBox)base.CreateCellEditElement(cell, dataItem);
    textbox.IsEnabled = false;
    return textbox;
}

Please let me know if you need further assistance.

Best wishes,
Yavor Georgiev
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
0
Eric
Top achievements
Rank 1
answered on 06 Sep 2011, 10:08 PM
Marc,
I think this is what you are looking for. Set the DataFormatString to

<telerik:GridViewMaskedTextBoxColumn DataMemberBinding="{Binding FeeWaived, Mode=TwoWay}" Header="Out of Pocket" IsReadOnly="False" MaskType="Numeric" Mask="c" DataFormatString="{}{0:c}"/>

Tags
GridView
Asked by
Marc
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Eric
Top achievements
Rank 1
Share this question
or