Hello
I have a ASP.NET AJAX site which lets you generate bills. These have a header and lines.
It does have a button to generate a PDF report of this bill.
The form is a RadDataForm, always in edit mode, and inside of it, besides header fields, it's a RadGrid for the bill lines .
Until now, you have to first click the built in save button in the RadDataForm, then you can click on the generate PDF, otherwise the PDF is outdated (it doesn't save the modified header and lines). Now it's required that only clicking on the generate PDF button first save everything in the radDataForm, then it generates the PDF with updated values. I managed to save the header data before executing the PDF code but I can't figure out how to save the lines (RadGrid), because if I trigger it, then stops executing and the PDF report isn't generated at all.
The Save button has a client side Javascript event attached to save the RadGrid status.
var grid1 = $telerik.findControl(document.documentElement, "RadGrid1");
var batchManager1 = grid1.get_batchEditingManager();
var hasChanges = batchManager1.hasChanges(grid1.get_masterTableView());
if (hasChanges) {
batchManager1.saveTableChanges([grid1.get_masterTableView()]);
ajaxPanel.ajaxRequest("saveChanges");
} else {
var ajaxPanel = $telerik.findControl(document.documentElement, "RadAjaxPanel1");
ajaxPanel.ajaxRequest("saveChanges");
}
If I add that same client side function in the generate PDF, it saves the RadGrid but it doesn't execute the generate PDF code (possibly due to the Postback preventing it to reach the server side function that generates the report and PDF)
I use the BatchEditCommand to manually get the updated, inserted or deleted rows and execute the SQL queries to do that. But I can't get the list of commands (the GridBatchEditingEventArgs e) without this event
Is there a way to save the radDataForm first (including the RadGrid) then generating the PDF file (it's a server side function)
Many thanks!