It seems that you cannot have a fileupload control postback a file if it is inside of a usercontrol that is inside of a updatepanel. Can anyone confirm this? Is there a way around this problem? Am I just doing something wrong?
Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
if you look around the forums and google, you can read more about the problem if your interested, but the code project solution should get you started.
Controls that are incompatible with partial-page rendering can still be used on a page outside
UpdatePanel controls. Additionally, in some cases you can use the controls in a specific way to make them compatible with partial-page updates. For example, you can use the
Login,
ChangePassword, or PasswordRecovery controls inside an
UpdatePanel control if you can convert their contents to templates. (If you are using Visual Studio, in Design view you can convert the controls by using smart-tag menu commands such
as Convert to Template or Customize Create User Step.) When you convert these controls into editable templates, the validation controls that are used in the control are defined declaratively by using markup in
the page. To make the validators compatible with an
UpdatePanel control, set the
EnableClientScript property of the validators to false. This disables the client script that would ordinarily be used to perform validation in the browser. As a result, during an asynchronous postback, the validators perform
validation on the server. However, because only the content of the
UpdatePanel is refreshed, the validators can provide the kind of immediate feedback that is ordinarily provided by client script.
To use a FileUpload control inside an
UpdatePanel control, set the postback control that submits the file to be a
PostBackTrigger control for the panel.
All other controls work inside
UpdatePanel controls. However, in some circumstances, a control might not work as expected inside an
UpdatePanel control. These circumstances include the following:
Registering script by calling registration methods of the
ClientScriptManager control.
Rendering script or markup directly during control rendering, such as by calling the
Write(String) method.
If the control calls script registration methods of the
ClientScriptManager control, you could use corresponding script registration methods of the
ScriptManager control instead. In that case, the control can work inside an
UpdatePanel control.
Dested
Participant
752 Points
168 Posts
Fileupload inside updatepanel problems
Aug 06, 2007 06:15 AM|LINK
It seems that you cannot have a fileupload control postback a file if it is inside of a usercontrol that is inside of a updatepanel. Can anyone confirm this? Is there a way around this problem? Am I just doing something wrong?
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
kaushalparik...
All-Star
26580 Points
3693 Posts
MVP
Re: Fileupload inside updatepanel problems
Aug 06, 2007 06:48 AM|LINK
This problem is somewhat well documented, the update panel is listed as not working with certain controls.
File upload, and tree view being 2 of the biggies.
IN any case, one solution is available on code project:
http://www.codeproject.com/useritems/simpleajaxupload.asp
if you look around the forums and google, you can read more about the problem if your interested, but the code project solution should get you started.
[KaushaL] || BloG || Twitter
Don't forget to click "Mark as Answer" on the post that helped you.
kaushalparik...
All-Star
26580 Points
3693 Posts
MVP
Re: Fileupload inside updatepanel problems
Aug 06, 2007 06:48 AM|LINK
From the online documentation:
http://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx
Controls that Are Not Compatible with UpdatePanel Controls
The following ASP.NET controls are not compatible with partial-page updates, and are therefore not supported inside an UpdatePanel control:
TreeView and Menu controls.
Web Parts controls. For more information, see ASP.NET Web Parts Controls.
FileUpload controls when they are used to upload files as part of an asynchronous postback.
GridView and DetailsView controls when their EnableSortingAndPagingCallbacks property is set to true. The default is false.
Login, PasswordRecovery, ChangePassword, and CreateUserWizard controls whose contents have not been converted to editable templates.
The Substitution control.
Validation controls, which includes the BaseCompareValidator, BaseValidator, CompareValidator, CustomValidator, RangeValidator, RegularExpressionValidator, RequiredFieldValidator, and ValidationSummary control.
Controls that are incompatible with partial-page rendering can still be used on a page outside UpdatePanel controls. Additionally, in some cases you can use the controls in a specific way to make them compatible with partial-page updates. For example, you can use the Login, ChangePassword, or PasswordRecovery controls inside an UpdatePanel control if you can convert their contents to templates. (If you are using Visual Studio, in Design view you can convert the controls by using smart-tag menu commands such as Convert to Template or Customize Create User Step.) When you convert these controls into editable templates, the validation controls that are used in the control are defined declaratively by using markup in the page. To make the validators compatible with an UpdatePanel control, set the EnableClientScript property of the validators to false. This disables the client script that would ordinarily be used to perform validation in the browser. As a result, during an asynchronous postback, the validators perform validation on the server. However, because only the content of the UpdatePanel is refreshed, the validators can provide the kind of immediate feedback that is ordinarily provided by client script.
To use a FileUpload control inside an UpdatePanel control, set the postback control that submits the file to be a PostBackTrigger control for the panel.
All other controls work inside UpdatePanel controls. However, in some circumstances, a control might not work as expected inside an UpdatePanel control. These circumstances include the following:
Registering script by calling registration methods of the ClientScriptManager control.
Rendering script or markup directly during control rendering, such as by calling the Write(String) method.
If the control calls script registration methods of the ClientScriptManager control, you could use corresponding script registration methods of the ScriptManager control instead. In that case, the control can work inside an UpdatePanel control.
[KaushaL] || BloG || Twitter
Don't forget to click "Mark as Answer" on the post that helped you.