PDA

View Full Version : [CLOSED] File Postback



odyssey
Mar 24, 2014, 10:23 AM
I have following cod


<ext:FormPanel runat="server" ID="frmFileUpload" Title="File Validation" BodyPadding="5"
Url="handlers/file_validator.ashx/processFile" Width = "450">
<Items>
<ext:FileUploadField ID="flUploadfield" FieldLabel="File Name" runat="server" Width="400"
Icon="Attach">
<Listeners>
</Listeners>
</ext:FileUploadField>
<ext:FieldContainer ID="FieldContainer1" runat="server" Layout="HBoxLayout" Width = "400">
<LayoutConfig>
<ext:HBoxLayoutConfig Pack="End">
</ext:HBoxLayoutConfig>
</LayoutConfig>
<Items>
<ext:Button ID="Button1" runat="server" Text="Submit for validation file" Icon="StyleGo">
<Listeners>
<Click Handler="#{frmFileUpload}.getForm().submit();" >
</Click>
</Listeners>
</ext:Button>
</Items>
</ext:FieldContainer>
</Items>
<Buttons>
</Buttons>
<Listeners>

</Listeners>
</ext:FormPanel>

After file submit I am doing some processing and the result must be displayed but unfortunatly I am not able to do so
for Example as displayed above form submits to the handlers/file_validator.ashx/processFile.



public void processFile() {

System.Threading.Thread.Sleep(2000);
string flName =ctx.Request.Files["flUploadfield"].FileName;
//process file and show result

Ext.Net.Window wnd = new Window();
wnd.Width = new System.Web.UI.WebControls.Unit("100px");
wnd.Height = new System.Web.UI.WebControls.Unit("100px");
wnd.Html = "File has been processed";
Ext.Net.ComponentLoader.Render(wnd);




}

because postback occures how to deliver the message from processFile function

Daniil
Mar 24, 2014, 2:25 PM
Hi @odyssey,

Do you use the DirectResponse class? If so, you should set up its IsUpload property to true.

odyssey
Mar 24, 2014, 2:55 PM
Hi @odyssey,

Do you use the DirectResponse class? If so, you should set up its IsUpload property to true.
this just works

var window = new Window("Server time", Icon.Time)
{
ID = "MyWindow",
Html = DateTime.Now.ToString(),
Hidden = true
};

// some condition makes us show it now
window.Show();

return new DirectResponse(window.ToScript());

I will stick with this solution