I am using WebDataGrid within Infragistics45.Web.v19.2 assembly.
When I apply formatting to an editable cell using DataFormatString property inside the HTML markup, and make a change to that cell during run-time, the row does not get marked as dirty. This prevents the RowUpdating event from firing, and hence the data does not get updated.
Is this an Infragistics bug? Can you suggest an alternate way of applying formatting to an editable cell?
Here is some of the relevant markup and code:
HTML:<ig:WebDataGrid runat="server" ID="wdg" DataKeyFields="Id" Width="100%" AutoGenerateColumns="false" EnableDataViewState="true"><Columns><igtbl2:BoundDataField Key="Id" DataFieldName="Id"></igtbl2:BoundDataField><igtbl2:BoundDataField Key="Price" DataFieldName="Price" CssClass="EditableCell"></igtbl2:BoundDataField> </Columns><Behaviors><igtbl2:EditingCore BatchUpdating="true"><Behaviors> <igtbl2:CellEditing EditModeActions-MouseClick="Single" EditModeActions-EnableF2="true" EditModeActions-EnableOnActive="true" EditModeActions-EnableOnKeyPress="true" Enabled="true" CellEditingClientEvents-EnteringEditMode="wdg_CellEdit"> </igtbl2:CellEditing> </Behaviors></igtbl2:EditingCore></Behaviors></ig:WebDataGrid>
Javascript:function wdg_CellEdit(sender, eventArgs) {var cellToEdit = eventArgs.getCell().get_column().get_key();if (cellToEdit != "Price") {eventArgs.set_cancel(true);}}
Hello,
Thank you for posting in our community.
I have created a sample based on the provided code snippet trying to reproduce the described behavior. When editing is done on a formatted cell, WebDataGrid marks its row as dirty, and on postback the OnRowUpdating event fires as expected.
Please test the sample on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve, please feel free to modify it and send it back to me along with steps to reproduce.
Looking forward to hearing from you.
6165.Sample.zip
Thank you. I was applying DataFormatString="{0:###,0}" for the editable cell.
I modified it to DataFormatString="{0:N0}" as per your sample. That resolved the issue.
However, there is an issue with negative numbers. It will apply formatting when editing the cell, but it does NOT format (add commas) for negative numbers when the grid loads.
Any ideas?
This is the default behavior when the currency is dollars. More information can be found here.
What I can suggest is to take a look at this forum post where it is explained how to format the field during the OnInit event of WebDataGrid.