Hi,
Currently I am using webdaatagrid to show records in the grid. The problem that I am facing is that when I click the cell to enter value the number gets divided by 100.
For ex- 5.5 is displayed as 0.05 and 10,992 is displayed as 10992.00 and 256 as 2.56.Why is this happening so? What needs to be done to fix this?
Hello Prabhakar,
Thank you for contacting Infragistics!
I have some follow up questions concerning this matter:
How are you setting up the grid?How are you setting up the editor?What version are you using?
I am using Webdatagrid v12. Below is the code. Which editor providers should be used?
<ig:WebDataGrid ID="dgCompanyStats" runat="server" Height="600px" Width="900px" AutoGenerateColumns="False" ClientEvents-DoubleClick="dg_CompanyStats_CellClickHandler" DataKeyFields="CS_ID" EnableDataViewState="True" OnInitializeRow="dgCompanyStats_InitializeRow"> <EditorProviders> <ig:NumericEditorProvider ID="WebDataGrid1_NumericEditorProvider1"> <EditorControl ClientIDMode="Predictable" DataMode="Float" MaxDecimalPlaces="2" MinDecimalPlaces="2" ValueText="0" > </EditorControl> </ig:NumericEditorProvider> </EditorProviders> <Columns> <ig:BoundDataField DataFieldName="cs_id" Key="cs_id" Hidden="true"> </ig:BoundDataField> <ig:BoundDataField DataFieldName="cs_picture" Key="cs_picture" Hidden="true"> </ig:BoundDataField> <ig:BoundDataField DataFieldName="cs_num" Key="cs_num" Width="25px"> <Header Text="#"></Header> </ig:BoundDataField> <ig:UnboundField Key="Notes" Width="30px" Footer-Text="..."> <Header Text="Notes" /> <Footer Text="..."></Footer> </ig:UnboundField> <ig:BoundDataField DataFieldName="cs_name" Key="cs_name" Width="300px"> <Header Text="Name"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="cs_desc" Key="cs_desc" Width="150px" Hidden="true"> <Header Text="Name"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="MI_YEAR_1" Key="MI_YEAR_1" DataType="System.String" CssClass="Right"> <Header Text=""></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="MI_YEAR_2" Key="MI_YEAR_2" DataType="System.String" CssClass="Right"> <Header Text=""></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="MI_YEAR_3" Key="MI_YEAR_3" DataType="System.String" CssClass="Right"> <Header Text=""></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="MI_YEAR_4" Key="MI_YEAR_4" DataType="System.String" CssClass="Right"> <Header Text=""></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="MI_YEAR_5" Key="MI_YEAR_5" DataType="System.String" CssClass="Right"> <Header Text=""></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="NUM_NOTES" Key="NUM_NOTES" DataType="System.String" Hidden="true"> <Header Text=""></Header> </ig:BoundDataField> </Columns> <Behaviors> <ig:EditingCore AutoCRUD="False"> <Behaviors> <ig:CellEditing> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="cs_num" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="Notes" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="cs_name" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="cs_picture" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="cs_id" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="MI_YEAR_1" ReadOnly="False" EditorID="WebDataGrid1_NumericEditorProvider1" /> <ig:EditingColumnSetting ColumnKey="MI_YEAR_2" ReadOnly="False" /> <ig:EditingColumnSetting ColumnKey="MI_YEAR_3" ReadOnly="False" /> <ig:EditingColumnSetting ColumnKey="MI_YEAR_4" ReadOnly="False" /> <ig:EditingColumnSetting ColumnKey="MI_YEAR_5" ReadOnly="False" /> </ColumnSettings> <CellEditingClientEvents ExitedEditMode="dgCompanyStats_CellEditing_ExitedEditMode" /> <EditModeActions EnableOnKeyPress="True" MouseClick="Single" EnableOnActive="False" /> </ig:CellEditing> </Behaviors> </ig:EditingCore> <ig:Activation> </ig:Activation> <ig:Selection CellClickAction="Row" RowSelectType="Single"> </ig:Selection> <ig:RowSelectors> <RowSelectorClientEvents RowSelectorClicked="RowSelectionChanging" /> </ig:RowSelectors> </Behaviors> </ig:WebDataGrid>
Thank you for the update. Which editor you would use would depend on what you want to achieve. From what you have mentioned so far I don’t see why you can’t just use the basic default editor with the DataFormatString set. You say you are using version 12, is that v12.1 or v12.2? Also what service release for that version are you using? Do you have a sample that demonstrates the behavior you are seeing?
The version is 15.2. Actually I am displaying percentage on grid cell on InitializeRow as
e.Row.Items[i].Text = value + "%" ;
Where value is some number less than 100. When I click on cell for eg. If it is displaying "15%" when the grid loads for the first time and if I click on cell to edit, the cell enters in edit mode but the number is diplayed as ".15" and not 15. I think the % sign is making the number divided by 100. If it is so how can I fix this to display 15 in the cell instead of .15 while editing ?
Hello,
Thank you for the update. Setting the texting in the initialize row as you are doing only modifies the text, it does not affect the value. I am attaching a sample that demonstrates this behavior. I have been unable to reproduce the behavior you describe of values getting divided by 100 when entering edit mode on a cell. Please attach a sample that reproduces this behavior.