I handle the OnCommand client-side event for a Grid. I pull out the ID of the record of interest. Part of that record is a byte stream that contains the contents of a PDF file. The OnCommand handler calls radopen to display an aspx page:
The ShowInvoicePDF markup is just like the VS2010 wizard created it and I added nothing to it. I do this in the Page_Load method.
When the webapp is run using IE 8 under Windows 7, the radwindow comes up but all I see is the rotating RadAjaxLoadingPanel wheel. If I use FireFox it works fine. If I run the ShowInvoicePDF.aspx file directly from the IE browser, it works fine, so there must be some kind of interaction with javascript/ajax/radwindow happening. Why is this happening (an answer of "because you are using MS IE" is not a valid response)? What do I need to do to make it work on all browsers?
| function RadGrid1_OnCommand(sender, eventArgs) { |
| var nID = sender.get_masterTableView().get_dataItems()[0].getDataKeyValue("ID"); |
| var commandName = eventArgs.get_commandName(); |
| if (commandName == "PDF") { |
| var wnd = window.radopen("/ShowInvoicePDF.aspx?ID=" + nID, null); |
| return false; |
| } |
| } |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| int nID = Convert.ToInt32(Request.QueryString["ID"]); |
| Invoice invoice = Invoice.FindByID(nID); |
| Response.Clear(); |
| Response.ClearContent(); |
| Response.ClearHeaders(); |
| Response.Buffer = true; |
| Response.ContentType = "Application/pdf"; |
| Response.AddHeader("Accept-Ranges", "bytes"); |
| Response.AddHeader("Accept-Header", invoice.PDFData.Length.ToString()); |
| Response.AddHeader("Cache-Control", "public"); |
| Response.AddHeader("Cache-Control", "must-revalidate"); |
| Response.AddHeader("Pragma", "public"); |
| Response.AddHeader("expires", "0"); |
| //Response.BinaryWrite(invoice.PDFData); |
| Response.OutputStream.Write(invoice.PDFData, 0, invoice.PDFData.Length); |
| //Response.Flush(); |
| //Response.Close(); |
| Response.End(); |
| } |