<telerik:RadGrid ID="TourGrid" runat="server" AutoGenerateColumns="false" AllowSorting="false" AllowMultiRowSelection="false" OnNeedDataSource="TourGrid_NeedDataSource" OnPreRender="TourGrid_PreRender" AllowMultiRowEdit="true" OnItemCreated="TourGrid_ItemCreated"> <MasterTableView Width="100%" DataKeyNames="Id" EditMode="InPlace"> <Columns><%-- columns left out --%> <telerik:GridNumericColumn DataField="NewValue" UniqueName="NewValue" HeaderText="New value" ReadOnly="false" ColumnEditorID="GridNumericColumnEditor1" HeaderStyle-Width="175px" DataFormatString="{0:D}" AllowRounding="false" KeepNotRoundedValue="true" DataType="System.Double" /> </Columns> </MasterTableView> <ClientSettings ReorderColumnsOnClient="false" AllowDragToGroup="false" AllowColumnsReorder="false" AllowRowsDragDrop="false"> <Selecting AllowRowSelect="true" EnableDragToSelectRows="false" /> <Resizing AllowRowResize="true" AllowColumnResize="true" EnableRealTimeResize="true" ResizeGridOnColumnResize="false" /> <Scrolling AllowScroll="true" UseStaticHeaders="true" FrozenColumnsCount="1" /> <ClientEvents /> </ClientSettings> </telerik:RadGrid><telerik:GridNumericColumnEditor ID="GridNumericColumnEditor1" runat="server"> <NumericTextBox runat="server"> <NumberFormat NumericPlaceHolder="_" DecimalSeparator="," GroupSeparator="." KeepTrailingZerosOnFocus="true" AllowRounding="false" KeepNotRoundedValue="true" /> </NumericTextBox> </telerik:GridNumericColumnEditor>I have the above grid in one of my aspx-pages.
The code-behind contains the following event handler:
protected void TourGrid_PreRender(object sender, System.EventArgs e) { if (!IsPostBack) { foreach (GridItem item in this.TourGrid.MasterTableView.Items) { if (item is GridEditableItem) { GridEditableItem editableItem = item as GridDataItem; editableItem.Edit = true; } } this.TourGrid.Rebind(); } }This makes all the 'NewValue' fields go into edit mode when the page is loaded.
The input field should not round the values which the user enters on the page, nor should a rounded value be displayed. With the markup above however the first row in the grid keeps the not rounded value but cuts off decimal digits after the first two. All the other rows after the first round the value in the input box to two decimal digits and do not keep the not rounded values.
But I want the input boxes to keep the not rounded values and display all the digits of the values regardless wether the box is active (has focus) or not. How can I achieve this?
Regards, Viktor