Our asp.net application uses EXT.NET. When a "View" menu is clicked, an EXT.NET window shows up with a content of a PDF file. The problem is we can't drag and drop that window to a body of an Outlook email (to make it as the email attachment).
I am thinking one of the way to drag and drop to a body of an Outlook email is to show the PDF file in the browser window, not an EXT.NET window. How can I do that ? Thank you.
This is from the View (Index.cshtml):
@{
ViewBag.Title = "Archive";
var X = Html.X();
}
@section SPAViews {
@(
X.Viewport().Layout(LayoutType.Fit).Items(
X.TabPanel().ID("ArchiveTabPanel")
.Items(
X.GridPanel().ID("GridPanel1").MarginSpec("1 1 1 1").Cls("cust-grid").Title("Archive").Icon(Icon.ServerCompressed)
.Plugins(X.GridFilters())
.View(Html.X().GridView().StripeRows(true).TrackOver(false))
.SelectionModel(X.CheckboxSelectionModel().Mode(SelectionMode.Multi))
.TopBar(
X.Toolbar().MinHeight(35)
.Items(
:
, X.Button()
.Text("View")
.Icon(Icon.PageWhiteAcrobat)
.DirectEvents(de =>
{
de.Click.Action = "Submit";
de.Click.EventMask.ShowMask = true;
de.Click.Method = HttpMethod.POST;
de.Click.ExtraParams.Add(new Parameter()
{
Name = "selection",
Value = "getselection()",
Mode = ParameterMode.Raw
});
de.Click.Timeout = 360000;
})
This is from ArchiveController.cs:
public ActionResult Submit(string selection)
{
int cnt = SetTempData(selection);
RenderWindows(String.Format("View Archive {0}.",cnt),0,cnt);
return this.Direct();
}
[ChildActionOnly]
public void RenderWindows(string title,int download,int cnt)
{
Window win = new Window
{
ID = "Windows1",
Title = title,
Icon = Ext.Net.Icon.PageWhiteAcrobat,
Height = download == 1 ? 150 : 600,
Width = download == 1 ? 400 : 800,
BodyPadding = 2,
Modal = true,
Layout = "Fit",
CloseAction = CloseAction.Destroy,
Loader = new ComponentLoader()
{
Url = Url.Action("ArcTicket", "Archive"),
Mode = LoadMode.Frame,
DisableCaching = true,
ShowWarningOnFailure = true,
LoadMask = { ShowMask = true, Msg = String.Format("Generating {0} pdf ...",cnt) }
},
Buttons = {
new Button(){ Text="Close & Clear", Icon=Ext.Net.Icon.TableRowDelete, Handler="App.GridPanel1.selModel.deselectAll();App.Windows1.close();"},
new Button(){ Text="Close", Icon=Ext.Net.Icon.Cancel, Handler="App.Windows1.close();"}
}
};
win.Loader.Params.Add(new Parameter() { Name = "download", Value = download.ToString(), Mode = ParameterMode.Value });
win.Render(RenderMode.Auto);
}
public FileStreamResult ArcTicket(int download)
{
String id = TempData["xid"].ToString();
TempData.Remove("xid");
String ticket = Uow.TICKETs.GetXmlBatch(id);
Byte[] pdf = MvcApplication.Fop.Write(enumFobFormat.Pdf
, ticket
, Server.MapPath("/Resources/xslt/Ticket.xsl")
);
MemoryStream ms = new MemoryStream(pdf);
FileStreamResult fs = new FileStreamResult(ms, "application/pdf");
if (download == 1)
fs.FileDownloadName = string.Format("Archive_{0:yyyyMMdd_HHmmss}.pdf", DateTime.Now);
return fs;
}