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

Radnumeric inside edit template issue

5 Answers 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gilberto
Top achievements
Rank 1
Gilberto asked on 16 Feb 2012, 05:50 AM
I have a issue in this radgrid in particular at templated column with radnumericbox inside the edittemplate, currency type and culture pt-br

The value in database is 10.00

The label in template of related column shows R$ 10,00 (it's ok).

When i enter in edit mode the radnumerictextbox shows R$ 1000,00 unselected and shows 1000 when got focus,  seems  it does not interprets the decimal point even when i force the numberformat properties. <NumberFormat GroupSeparator="." DecimalSeparator="," />

Did i missed something?

Gilberto
 
 <telerik:RadGrid ID="RadGridAnuidades" ValidationSettings-ValidationGroup="grid"
                                    runat="server" OnDataBound="RadGridAnuidades_DataBound" CellSpacing="0" GridLines="None"
                                    AllowAutomaticUpdates="True" DataSourceID="SqlDataSourceUpdateAnuidades" OnNeedDataSource="RadGridAnuidades_NeedDataSource">
                                    <ValidationSettings ValidationGroup="grid"></ValidationSettings>
                                    <MasterTableView AutoGenerateColumns="False" DataKeyNames="CódigoSócio,Ano" EditMode="InPlace"
                                        DataSourceID="SqlDataSourceUpdateAnuidades">
                                        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                                        <Columns>
                                            <telerik:GridBoundColumn DataField="CódigoSócio" Visible="false" DataType="System.Int32"
                                                FilterControlAltText="Filter CódigoSócio column" HeaderText="CódigoSócio" ReadOnly="True"
                                                SortExpression="CódigoSócio" UniqueName="CódigoSócio">
                                            </telerik:GridBoundColumn>
                                           
                                            <telerik:GridTemplateColumn DataField="Valor" DataType="System.Decimal" FilterControlAltText="Filter Valor column"
                                                HeaderText="Valor" SortExpression="Valor" UniqueName="Valor">
                                                <EditItemTemplate>
                                                    <telerik:RadNumericTextBox ID="RadNumericTextBoxValor" runat="server" Type="Currency"
                                                        Culture="pt-BR" Text='<%# Bind("Valor") %>'>
                                                        <NumberFormat GroupSeparator="." DecimalSeparator="," />
                                                    </telerik:RadNumericTextBox>
                                                    <asp:RequiredFieldValidator ValidationGroup="grid" ID="requiredfieldvalidatorValor"
                                                        runat="server" ControlToValidate="RadNumericTextBoxValor" CssClass="failureNotification"
                                                        ErrorMessage=" *">
                                                    </asp:RequiredFieldValidator>
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="ValorLabel" runat="server" Text='<%# Bind("Valor", "{0:C2}") %>'></asp:Label>
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>
                                            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                                                <ItemStyle CssClass="MyImageButton" />
                                            </telerik:GridEditCommandColumn>
                                           
                                        </Columns>
                                     
                                    </MasterTableView>
                                    
                                </telerik:RadGrid>

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 Feb 2012, 06:10 AM
Hello Gilberto,

Try setting KeepTrailingZerosOnFocus as true for the RadNumericTextBox.

-Shinu.
0
Gilberto
Top achievements
Rank 1
answered on 16 Feb 2012, 06:24 AM
Thanks Shinu

Unfortunately, does not works.
0
Gilberto
Top achievements
Rank 1
answered on 17 Feb 2012, 06:42 PM
Usually we have decimal 18,2 to currency fields in database, but thats the trick i changed to float type in database and everyhing works fine now.

We should have some warnings in documentation.

Thanks
0
Gilberto
Top achievements
Rank 1
answered on 22 Feb 2012, 11:53 PM
well, after i changed the database field type, edit works but insert no.

Could someone from telerik elaborate some more about this issue? It seems to be very easy but its driving me crazy.

Please Help

Gilberto
0
Gilberto
Top achievements
Rank 1
answered on 23 Feb 2012, 03:59 PM
Actually everything works if you bound to a DbValue property.

Thanks
Tags
Grid
Asked by
Gilberto
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Gilberto
Top achievements
Rank 1
Share this question
or