Hi,
I would appreciate it a lot if someone could please help me with this.
I have an updatepanel which has a button, which when clicked shows the web dialog window, and within that dialog window I have a file upload control and a button upload to save that file. FileControl.HasFile is always returning false. What way can I work around this? I have tried using the <Triggers><asp:PostBackTrigger ControlID="" /></Triggers> of the update panel but get an error that it can't find the control.
I tried registering the PostBackTrigger through code below. It does not give any error but still the HasFile Property return false.
ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);if (scriptManager == null) { scriptManager.RegisterPostBackControl(this.btnUpload);
}
What is the way to use FileUpload control inside a WebDialogWindow. ? Any help would be really appreciated.
Thanks ,
Kimsi
Hello Kimsi,
After some investigation, I have found that this issue isn’t related to the WebDialogWindow, in fact it is related to the UpdatePanel, this could be verified if you move the FileUpload from the WebDialogWindow to the UpdatePanel and the result would be the same.
What I can suggest you is reviewing the following blog in the knowledgebase, which provides explanation of how to fix this with encoding the form with "multipart/form-data". You may also find this stackoverflow post helpful, since it provides few different solutions to this issue.
Please let me know if you have any questions.
Regards, Ivan Kitanov
Thanks Ivan for the quick response.
I have tried taking out the FileUpload from WebDialogWindow and directly using it in UpdatePanel. It works fine using PostBackTrigger . But it does not work with in WebDialogWindow.
I will try using other options as well and let you know. Thanks for help.
Regards,
I have created a small sample trying to create an UpdatePanel that contains WebDialogWindow. The window has FileUpload a TextBox for the result of the upload and a button that commits the upload. As I mentioned in my previous reply a full PostBack is needed for the FileUpload to work inside an UpdatePanel. It could be achieved by adding a PostBackTrigger for the WebDialogWindow, similar to the line below:
<asp:PostBackTrigger ControlID="WebDialogWindow1" />
Since you also mentioned that you would like to try other options of uploading files, I can suggest you the WepUpload control, to learn more about it, please visit the page below:
https://es.infragistics.com/help/aspnet/webupload-overview
Please test the sample on your side and let me know if you have any questions.
WebDialogWindowFileUpload.zip
Hello Ivan,
Thank you so much ! Registering WebDialogWindow as PostBackTrigger worked for me very well.
I really appreciate your help on this.
Also, thanks for sharing the link on WebUpload , i will explore that as well.
Thanks & Regards,
Kimsi Bansal
I’m glad that you found my suggestion helpful and managed to resolve your issue.
Thank you for choosing Infragistics!