PDA

View Full Version : [CLOSED] Show Open/Save File Dialog box and hide Ext.Net Window



jtorkels
Jul 12, 2013, 12:38 AM
Hi, I have a GridCommand that when clicked should show the browser's open/save as file dialog window to download a zip file. The code below works when setting Hidden = false inside the ext.net window, but I don't need the window and want to hide it. Any suggestions?



<ext:CommandColumn runat="server" Width="50" >
<Commands>
<ext:GridCommand Icon="PageWhiteCompressed" CommandName="Download" >
<ToolTip Text="Download Application Files" />
</ext:GridCommand>
</Commands>
<DirectEvents>
<Command OnEvent="ReviewAppDetails" IsUpload="true" >
<EventMask ShowMask="true" Target="CustomTarget" CustomTarget="{#{FellowshipGrid}.body};" />
<ExtraParams>
<ext:Parameter Name="command" Value="command" Mode="Raw"/>
<ext:Parameter Name="SelectAcadYear" Value="record.data.acadYear" Mode="Raw" />
</ExtraParams>
</Command>
</DirectEvents>
</ext:CommandColumn>




protected void ReviewAppDetails(object sender, DirectEventArgs e)
{
string commandValue = e.ExtraParams["command"].ToString();

if (commandValue == "Download")
{
string acadYear = e.ExtraParams["SelectAcadYear"].ToString();

System.Text.StringBuilder url = new System.Text.StringBuilder();
url.Append("Documents/");
url.Append(acadYear.ToString() + "_" + applicantID.ToString() + ".zip");

Window win = new Window
{
ID = "newDocument",
Title = "Download Zip File",
Icon = Icon.ApplicationKey,
Width = Unit.Pixel(1000),
Height = Unit.Pixel(600),
Maximizable = true,
Collapsible = false,
Modal = true,
Hidden = true
};

ComponentLoader cloader = new ComponentLoader();
cloader.Url = url.ToString();
cloader.Mode = LoadMode.Frame;
win.Loader = cloader;
win.Render();
}
}

Baidaly
Jul 12, 2013, 12:59 AM
Hello!

Try to set AutoRender to true.

Also, I don't quite understand what is your scenario about this window? Do you use this window just to download a file? If you do, you can write the file directly to Response: http://examples2.ext.net/#/GridPanel/Miscellaneous/Export_Data_Ajax/

jtorkels
Jul 12, 2013, 4:45 PM
You are right. I don't need to have a window at all. I just wrote the file to the Response. Thanks for the help!