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

GridNumericColumn - number format changing when insert or edit

1 Answer 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
dmc
Top achievements
Rank 1
dmc asked on 03 Aug 2010, 08:51 PM
I have a RadGrid using the GridNumeric column.  I want this to show decimal number with 10 decimal places.  I am using a GridNumericColumnEditor to set format.  If the first action I take on the page is to edit a record the numeric values will show to correct decimal place; if I edit another record, the values then get clipped to 2 decimal places for edited record and any record I open for edit.  If I initially go into "Add New" the numeric text boxes will populate with a single zero.  Then when I edit an existing record, the edited records numeric text boxes will show 2 decimal places and the "add new" record text boxes now show 2 decimal places.

 

 

<telerik:GridNumericColumn DataField="Jan" HeaderText="Jan" AllowSorting="false" 
AllowFiltering="false" HeaderStyle-Width="90" HeaderStyle-Wrap="false"  
EditFormColumnIndex="1" EmptyDataText="0" DefaultInsertValue="0" AllowRounding="false" KeepNotRoundedValue="false" ColumnEditorID="GridNumericColumnEditor1" UniqueName="Jan" /> 
  
<telerik:GridNumericColumnEditor ID="GridNumericColumnEditor1" runat="server" 
NumericTextBox-Width="125px" NumericTextBox-NumberFormat-DecimalDigits="10" 
NumericTextBox-NumberFormat-AllowRounding="false" /> 

 

 

 

 

 

 

 

 




1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 04 Aug 2010, 09:16 AM
Hello,

I also experienced similar issue in my end. And as a workaround I tried accessing the RadNumericTextBox in edit mode and then set its DecimalDigits from code behind, like below.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
   {
      if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
       {
           GridEditFormItem editItem = (GridEditFormItem)e.Item;
           RadNumericTextBox txt = (RadNumericTextBox)editItem["Jan"].Controls[0];
           txt.NumberFormat.DecimalDigits = 10;
        }
   }

Regards,
Shinu.
Tags
Grid
Asked by
dmc
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or