Hi,
I am using RadNumericTextBox inside EditItemTemplate of a RadGrid. I have given DecimalDigits property of RadNumericTextBox as "2". But it accepts more than 2 decimal places depending on the MaxLength property. How can I restrict the decimal places only to 2 digits? Code I have used given below:
<telerik:GridTemplateColumn HeaderText="Debit" UniqueName="debit" DataType="System.Decimal" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Right" >
<ItemTemplate>
<asp:Label ID="lblDbAmt" Text= '<%# Eval("dbamt") %>' CssClass="labels" runat="server"> </asp:Label>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadNumericTextBox ID="txtDbAmt" Text = '<%# bind("dbamt") %>' MinValue="0" MaxValue="99999999" MaxLength="11" DataType="System.Decimal" Culture="en-GB" AutoPostBack="false" ClientEvents-OnKeyPress="KeyPressed" EnabledStyle-HorizontalAlign="Right" runat="server">
<NumberFormat AllowRounding="false" DecimalDigits="2" DecimalSeparator="." GroupSeparator="," GroupSizes="3" KeepNotRoundedValue="true" />
</telerik:RadNumericTextBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>
Alphonse
I am using RadNumericTextBox inside EditItemTemplate of a RadGrid. I have given DecimalDigits property of RadNumericTextBox as "2". But it accepts more than 2 decimal places depending on the MaxLength property. How can I restrict the decimal places only to 2 digits? Code I have used given below:
<telerik:GridTemplateColumn HeaderText="Debit" UniqueName="debit" DataType="System.Decimal" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Right" >
<ItemTemplate>
<asp:Label ID="lblDbAmt" Text= '<%# Eval("dbamt") %>' CssClass="labels" runat="server"> </asp:Label>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadNumericTextBox ID="txtDbAmt" Text = '<%# bind("dbamt") %>' MinValue="0" MaxValue="99999999" MaxLength="11" DataType="System.Decimal" Culture="en-GB" AutoPostBack="false" ClientEvents-OnKeyPress="KeyPressed" EnabledStyle-HorizontalAlign="Right" runat="server">
<NumberFormat AllowRounding="false" DecimalDigits="2" DecimalSeparator="." GroupSeparator="," GroupSizes="3" KeepNotRoundedValue="true" />
</telerik:RadNumericTextBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>
Alphonse