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
125
RowEdit Template posting back
posted

I am dynamically building the rowedit template within a div tag inside of the Grid definition:

<
RowEditTemplate>
<div id=divHandle runat=server>Add\Edit <%=FormName %></div>
<div id=divEnterForm runat=server>
<asp:Label ID=lblFormName runat=server CssClass=pagetitle></asp:Label>
<div id=divFormFields runat=server></div>
<p align=center><button id="ctl00_MainContent_grdHealthRec_ctl00_igtbl_reOkBtn" onClick="return SaveRec(event);">Save</button><span> </span><button id="ctl00_MainContent_grdHealthRec_ctl00_igtbl_reCancelBtn" onClick="CancelRec(event)">Cancel</button></p>
</div>
</RowEditTemplate>

Here are the respective save and cancel calls:

function SaveRec(e){
if(CheckForm(document.aspnetForm,0,0)){
    globalCancel = true;
    igtbl_gRowEditButtonClick(e);
    }
else
    return false;
}

function CancelRec(e){
    globalCancel=true;
    igtbl_gRowEditButtonClick(e);
    return false;
}

I have code to prevent the edit template from hiding if the Cancel button is not selected (default functionality). I maintain a variable to determine of the cancel button was selected. I believe I got this code form you site.

function grdHealthRec_BeforeRowTemplateCloseHandler(gridName, rowId, bSaveChanges){
 //Add code to handle your event here.
    if (!bSaveChanges && !globalCancel) {
        return true;
       }
}

This code works fine when editing an existing record, but if it's a new entry via the template by executing row.editRow() the post back occurs. Do you have an idea on what event is being executed to perform the postback? I tried to identify it with the FireFox debugger but could not. I tried executing the igtbl_cancelPostBack to no avail. This is delaying the deliverable and any help would be appreciated.

 

Parents Reply Children