I have a FileUpload control in a Wizard control. When I click the finish button, I set a breakpoint and I can see the filepath selected in the FileUpload control as expected.
However, when I Ajaxify this same Wizard, the value in the FileUpload control is always null at this breakpoint, as if a file hasn't been selected.
I know there's a limit where a FileUpload control can't keep its value after postback, but I have the breakpoint selected on the postback and would still expect to see the value.
Please check this thread: File uploading in AJAX updatepanel without full postback
You need a full postback to use the FileUpload control, try adding the FileUpload control to the PostBackTrigger section in the UpdatePanel.
See: Problem using the ASP.NET FileUpload control in an UpdatePanel?
Related
Dears,
Updatepanel is in Aspx page.
I have a fileupload in .ascx control. Ascx user control is added when its called and every thing else (rest of page controls i.e. listview) works fine on ascx control.
Only fileupload is set to null when Add Button click is fired. I have tried accepted code (another thread in stackoverflow Persist FileUpload Control Value) in Page_Load and even Page_Init but still it becomes null.
Kindly suggest.
To avoid auto post back I have used update panel covering my asp webpage which is having multiple repeater in it.
Each repeater having file upload control in it. Each file upload is showing me empty file when I am trying to save.
File Upload control faces issues working with updatepanel
so to solve it
define a postback trigger for your control in the updatepanel,
or
if that doesn't work then use AsyncFileUpload control from Ajax toolkit
This is really awkward. I am working on Telerik controls. I have a .NET web usercontrol which have some RadCombo boxes and a newly added RadTextBox. All of this in a RadAjaxPanel and RadLoadingAjaxPanel. When the user control loads, all of the control load values from database, including RadTextBox.
(The problem starts here) And when I try to update the RadTextBox control value and try to submit, I "Always" get the old value of the textbox.
Please check your Page_Load event and verify that you have an if(!IsPostBack) surrounding the code that loads the original values to the RadTextBox.
Recently I was working on a requirement as mentioned below:
There is a webform containing FileUpload control and below it there is a gridiview control.
When user clicks the browse button of the Fileupload control and picks an image to upload the image should now be available in the gridview using Jquery.
The binding of the gridview with the image source from Fileupload control should be done using Jquery.
Can anyone help me out with any code sample.
Thanks In Advance,
Thanks & Regards,
Santosh
If I'm correctly understand you, the one possible way to implement something similar to this requirement is to place gridview into UpdatePanel and use async file upload control like the AsyncFileUpload from the AjaxControlToolkit library or some else. With such control you can handle it's event fired in the client-side after the file successfully uploaded and call __doPostBack function in that event handler to re-bind gridview on server.
I have a RadGrid with a custom edit form (FormTemplate). The grid is in an UpdatePanel for asynchronous postbacks, as changing the selection in drop down lists and checkboxes needs to enable or disable other controls on the form. (Updating the controls synchronously is not acceptable to the user.)
As part of the edit form, I have a FileUpload control, but this does not upload the files when in an update panel.
I have tried adding the Insert/Update button as a PostBackTrigger on the UpdatePanel, but this causes an error on page load, as the UpdatePanel cannot find the control (the edit form is not open on load).
Is there a way to add/remove the trigger at runtime when the form is opened/closed?
Or is it possible to have the FileUploads work with the async-postback?
Yes, you have problem with is as FileUpload is in the list of controls that are not compatible with update panel (for more info here). One workaround for you could be swfupload. Another option is to use this jQuery plugin http://www.plupload.com/example_all_runtimes.php as stated here
There is a demo on the Telerik site that shows how to upload the files.
By using a RadAjaxPanel, RadCodeBlock and RadScriptManager with RadUploads instead of FileUploads it is possible to detect on the client side whether files have been selected for upload.
If there are files to upload, the AJAX postback can be disabled during the upload.
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/raduploadinajaxifiedgrid/defaultcs.aspx?product=upload&RadUrid=cde8a81e-0eb1-49ca-8c31-4dba37da90c4