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
1175
Firing JavaScript after Grid is loaded
posted

Hello there,

I have some problems accessing the EnterEditMode function:
We wrote a small wrapper function in our grid, which derives from webdatagrid:

function GridRowEnterEditMode(src, validationGroup) {

    var savePageValidate = undefined;

    if (typeof (Page_ClientValidate) != "undefined") {
        savePageValidate = Page_ClientValidate;
        Page_ClientValidate = undefined;
    }

    var row = jQuery(src).parents("tr[type='row']").get(0)._object;
    var editingCore = row.get_grid().get_behaviors().get_editingCore();


    debugger;

    if (editingCore != null) {
        var rowEditingTemplate = editingCore.get_behaviors().get_rowEditingTemplate();
        if (rowEditingTemplate != null) {
            rowEditingTemplate.enterEditMode(row);
        }
    }

    if (savePageValidate != undefined) {
        Page_ClientValidate = savePageValidate;
    }
    if (typeof (Page_ClientValidate) != "undefined" && validationGroup != null) {
        Page_ClientValidate(validationGroup);
    }
}

Works well, when I add it on a button client click event. Something like this:

OnClientClick="GridRowEnterEditMode(this, 'EditRole'); return false;"

But I need to enter the edit mode, when a load from another page happens.  tried to register a script per

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), script.ToString() + "Key", val, true);

I save the client id of the button he klicked in the sesson and pass it to a other javaScript function:

        function EnterRolesEditMode(btnClientId) {
            var grd = document.getElementById('dgrRoles');
            var btn = document.getElementById(btnClientId);
            grd.GridRowEnterEditMode(btn, 'EditRole');
        }

The idea is something like this:

  1. User presses on a button in the grid
  2. Edit mode gets shown --> Works
  3. User presses in another button
  4. The ClientId of the button he pressed gets saved in the session
  5. User gets redirected to another page whe he can enter some data
  6. User presses OK button on page 2 and gets redirected to page 1
  7. Page 1 checks, if there was a button id saved in the session, if yes, enter edit mode

Next step would be to reload the data from the session in the editing grid, but I'm stuck in the previous step.

I guess the problem is, when the Event fires the grid is not finished loading, so I kinda need to delay the javascript event till the loading finished.

Is there a easy solution to solve this?

Thanks for your response

Matthias

Parents Reply Children
No Data