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.
Are you handling the grid's AddRow or UpdateRow server-side events?
Vince,
I am handling the UpdateRow and DeleteRow events server side. I just identified another issue. I'm loading a webdatechooser control for the date value. After opening a new row to edit and selecting the date chooser to add a date, if the calender popup is outside of the Template, when I select the year/month dropdown or the date, eveything posts back and the Row Edit Template no longer displays.
I've been on this issue for well over a month. I've been putting it off. If you can get this solved Vince, I'll drive to Princeton and buy you lunch.