添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

ASPxClientGridViewBatchEditApi.SetCellValue(visibleIndex, columnFieldNameOrId, value) Method

Assigns a new value to the specified cell in batch edit mode .

// Sets a new value to the specified cell
clientGrid.batchEditApi.SetCellValue(rowIndex, 'ContactName', 'New customer');
// Sets a new value to the specified cell and disables its highlighting
clientGrid.batchEditApi.SetCellValue(rowIndex, 'ContactName', 'New customer', null, false)

This method is not in effect in the following cases:

  • The column’s Visible property is set to false.
  • The specified cell is in edit mode.
  • Add a New Row and Specify Its Cell Values

    When you call the AddNewRow method to create a new row, the grid switches to edit mode. The code sample below gets the visible index of the inserted row (the rowVisibleIndex property) and ends cell editing (the EndEdit method) to allow the grid to assign new values to the cells within the inserted row.

    <dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" KeyFieldName="CustomerID"
        ClientInstanceName="clientGrid">
        <Columns>
            <dx:GridViewDataTextColumn FieldName="ContactName" />
            <%--...--%>
        </Columns>
        <SettingsEditing Mode="Batch" />
    </dx:ASPxGridView>
    <dx:ASPxButton ID="ASPxButton1" runat="server" Text="Add New Row" AutoPostBack="false">
        <ClientSideEvents Click="OnButtonClick" />
    </dx:ASPxButton>
    
    function OnButtonClick(s, e) {
        clientGrid.batchEditApi.AddNewRow();
        var rowIndex = clientGrid.batchEditApi.GetEditCellInfo().rowVisibleIndex;
        clientGrid.batchEditApi.EndEdit();
        clientGrid.batchEditApi.SetCellValue(rowIndex, 'ContactName', 'New customer');
    

    Online Examples

    View Example: GridView for Web Forms - How to calculate values dynamically in batch edit mode View Example: Grid View for ASP.NET MVC - How to calculate values dynamically in batch edit mode View Example: ASPxGridView - Batch Edit - How to change a cell value based on another cell value (Web Forms) View Example: ASPxGridView - How to implement a popup Edit Form for GridView in Batch Edit mode (Web Forms)

    See Also
    ASPxClientGridViewBatchEditApi Class ASPxClientGridViewBatchEditApi Members Use of this site constitutes acceptance of our Website Terms of Use and Privacy Policy (Updated). Cookies Settings