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
Add empty row in webdatagrid


i am trying to add a new empty row to the webgridand select the new row and open the edit mode  by javascript but the selection didn't work

function insertRow() {

            var grid = $find('<%= WebDataGrid1.ClientID %>');
            var row = new Array(null,null,null,null,"ART000");

            var rows = grid.get_rows();
            var rowsLength = grid.get_rows().get_length();
            rowsLength ++;

            var selection = grid.get_behaviors().get_selection();
            var selectedRows = selection.get_selectedRows();
            if (selectedRows.get_length() > 0) {
                var row = selectedRows.getItem(5);
                // Get for example firs cell in the row and the cursor
                var cell = row.get_cell(5);
                var editingCore = row.get_grid().get_behaviors().get_editingCore();
                var rowEditing = editingCore.get_behaviors().get_rowEditing();


please someome tell me what iam doing wrong!

  • 140
    Offline posted

    Hello Mark,

    Thank you for posting in our community!
    I'm currently investigating how to properly add a row to the selected rows collection and how to enter edit mode for particular cell using client side code. I'll provide you with a sample demonstrating the required approach tomorrow, 06/26/2019.
    Best Regards,
    Martin Evtimov
  • 17270
    Offline posted in reply to Mark Web

    Hello Mark,

    Here you will find a sample where a new empty row is added at the bottom of the WebDataGrid on ”Add Row Client Side” button click. The grid will scroll down to the newly added row, which will be auto selected and the edit mode for particular cell (in this case the Date field) would be enabled. The adding happens in the insertRow() function. Since the row adding causes post-back, we need to wait for a response from the server and then continue with the implementation of our code. Therefore, we attach to the AjaxResponseComplete callback and by using AdditionalProperties (in this case I have set rowCount to -1) we can tell that this is the callback after executing the row adding.

    Thank you for using our product, if you have any further questions please contact me!