Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
Infragistics - WebDataGrid - Row does not get marked dirty when applying formatting to editable cell
posted

I am using WebDataGrid within Infragistics45.Web.v19.2 Ultimate UI for ASP.NET assembly.

When I apply formatting to an editable cell using the 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);
}
}



Parents
No Data
Reply
  • 15
    Offline posted

    Hello Friend,

    It seems that you are facing an issue with the Infragistics WebDataGrid where applying formatting to an editable cell using the DataFormatString property inside the HTML markup is causing problems with the RowUpdating event not firing during runtime. To address this, you might want to consider using a different approach to apply formatting to the editable cell.

    One possible solution is to use a TemplateColumn with an ItemTemplate for the DotNet Support cell you want to format. This way, you have more control over the rendering of the cell content while still allowing for editing. Here's an example of how you can modify your markup to use a TemplateColumn:

    ```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:TemplateDataField Key="Price" >
    <ItemTemplate>
    <asp:Label ID="lblPrice" runat="server" Text='<%# Bind("Price", "{0:C}") %>' CssClass="EditableCell"></asp:Label>
    </ItemTemplate>
    <EditModeTemplate>
    <asp:TextBox ID="txtPrice" runat="server" Text='<%# Bind("Price") %>' CssClass="EditableCell"></asp:TextBox>
    </EditModeTemplate>
    </igtbl2:TemplateDataField>
    </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>
    ```

    In this example, I replaced the BoundDataField for "Price" with a TemplateDataField. The ItemTemplate contains a Label for displaying the formatted value, and the EditModeTemplate contains a TextBox for editing. The `{0:C}` format in the Label's Text property ensures the value is displayed as currency.

    This way, you have more control over the formatting of the cell while still allowing for editing, and it may help resolve the issue you are facing with the RowUpdating event.

Children
No Data