How to implement print functionality in interfoft webgrid

3 replies. Last post: July 14, 2014 11:48 PM by Hans Kristian
Tags :
  • (None)

Hi All,

Please let me know how to implement print functionality.

I have attached the sample, in this sample i have integrated the print icon to the status bar on click of that icon, I am Exporting to HTML. After Exporting to HTML i want the print dialog box should open.

function PrintGridData(gridId) {                       
            var WebGrid2 = ISGetObject(gridId);           
            WebGrid2.ExportGrid(WebGrid2.RootTable.Id, "HTML", "PORTRAIT");
            //window.print();         
        }

 

Please give if any alternative way of doing.

 Regards,

Ganesh Nayak K

 
Ganesh

All Replies

Hello,

Thank you for your question.

By basically, WebGrid doesn’t have feature to print after exporting.
Perhaps you could create your own JavaScript code to handle Print function.

I am sorry for the inconvenience.

Regards,
Hans K.
Hello,

Thank u for your reply...

I want to open the print dialog box after Data exported in form of HTML. In current scenario print dialog box opens before exporting itself..

Can u share me the javascript code for handling the print functionality...

Thanks in advance

Ganesh Nayak K
 
Ganesh

Hello,

Basically, this printing scenario (code for printing) is beyond Intersoft control itself.
However, I will try to help you to find a work around for this printing scenario.

I try to modify one of WebGrid Samples, EnableExporting.aspx page.
In this page, I add OnExport server side event in the WebGrid and then I add a line of code to set the ReportName property.
Here’s the example code:

protected void WebGrid1_Export(object sender, ISNet.WebUI.WebGrid.ExportEventArgs e){
    e.ReportInfo.ReportName = "EnableExportingPage";
}

Next, I add OnAfterResponseProcess client side event to handle the printing scenario.
Here’s the code:

function printWindow() {
    var printWin = window.open("./TempReports/EnableExportingPage.html");
            
    if (printWin == null) {
        setTimeout(printWindow(), 500);
    }
    else {
        printWin.print();
        printWin.close();
    }
}

function WebGrid1_OnAfterResponseProcess(gridId, action, lastRequestObject, xmlResponseObject) {
    if (action == "Export") {
        printWindow();
    }
}


I attached the modify EnableExporting.aspx page as well. Please kindly add the page to the WebGrid Solution Samples, to see the result.

Thank you.

Regards,
Hans K.

All times are GMT -5. The time now is 5:10 PM.
Previous Next