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

Radgrid GridMaskcolumn, RadNumericTextBox, RadMaskedTextBox

2 Answers 189 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert Koerse
Top achievements
Rank 1
Robert Koerse asked on 25 Aug 2010, 03:41 PM

I try to use the GridMaskcolumn, RadNumericTextBox1 and RadMaskedTextBox

Why are the controls not the same:
- I was hoping the GridMaskedColumn en the RadMaskedTextBox  are the same with the parameters. e.g. DisplayMask
- Is it possible that when I use then Mask that when I press , (comma) or . (point) the cursor is moving to behind the decimal?
I have to move the cursor by mouse or cursorkeys.
- Why make different controls with the same purpose.
Can you make one control say: RadTextBox and make it with Mask, Numeric, Date what ever you want.

I don't know where to put the suggestions so i placed them in the forum.

<telerik:GridTemplateColumn HeaderText="Korting" SortExpression="oplgl_korting" UniqueName="oplgl_kortingTemp">
<ItemStyle HorizontalAlign="Left"></ItemStyle>
<ItemTemplate>
<%#Format(Eval("oplgl_korting"), "##0.00")%>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server" DataType="System.Decimal"
MaxLength="6" Font-Size="10px" MaxValue="999.99" MinValue="0" Type="Number" NumberFormat-DecimalDigits="2"
DbValue='<%# Bind("oplgl_korting") %>' />
<telerik:RadMaskedTextBox ID="RadMaskedTextBox1" runat="server"
DisplayMask="###,##"
Mask="###,##"
NumericRangeAlign="Left"
DisplayFormatPosition="Right"
DisplayPromptChar="_" Text='<%# Bind("oplgl_korting") %>'
>
</telerik:RadMaskedTextBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>

2 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 30 Aug 2010, 04:44 PM
Hello Robert Koerse,

Indeed you are correct that GridMaskedColumn does not provide a public property DisplayMask. However you can easily set a DisplayMask to the RadMaskedTextBox that is rendered when the column is edit mode using the code bellow:

protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        GridEditableItem item = e.Item as GridEditableItem;
        RadMaskedTextBox textBox = item["MyMaskedColumnUniqueName"].Controls[0] as RadMaskedTextBox;
        textBox.DisplayMask = "###,######";
    }
}

As to: Is it possible that when I use then Mask that when I press , (comma) or . (point) the cursor is moving to behind the decimal?
Note that the idea of the masked text box is to limit the user input only to those values that conform to the mask set. In addition, the control does not implement decimal separator recognition. Based on that I am afraid that the required functionality is not supported.

With regard to "Can you make one control say: RadTextBox and make it with Mask, Numeric, Date what ever you want." I hope you agree that if it was so easy to implement all the different functionality into a single control we would have already created it. The separation of concern is another principle based on which our developers have decided to create four different scenario specific controls instead of a single multifunctional one.

I hope this helps.

Greetings,
Martin
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
Robert Koerse
Top achievements
Rank 1
answered on 01 Sep 2010, 11:40 AM
Martin,

Thank you for the example and the answers to my questions.

Robert

Tags
Grid
Asked by
Robert Koerse
Top achievements
Rank 1
Answers by
Martin
Telerik team
Robert Koerse
Top achievements
Rank 1
Share this question
or