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:
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
Hello Matthias,
Based on the functionality you mentioned, I would recommend you to check if the document is ready to load with relevant dependencies.
The code example:
function GridRowEnterEditMode (src, validationGroup) {
if (document.readyState != "complete")
{
//Add some delay if document.readyState is not completed
window.setTimeout("GridRowEnterEditMode ()",500); }
else { //Code logic goes here } }
I hope this helps.
Hello Bhadresh
thanks for the hint, I'll check this out.