简体   繁体   English

由于母版页中的updatepanel,内容页中的asp FileUpload无法正常工作

[英]asp FileUpload in content page not working due to updatepanel in master page

I have a master page where an update panel contains the main placeholder of the content pages. 我有一个母版页,其中更新面板包含内容页的主要占位符。

Inside one of the content pages I need to disable the update panel in any way since I have a form with asp:fileupload control that is always returning null due to the update panel. 在内容页面之一中,我需要以任何方式禁用更新面板,因为我有一个带有asp:fileupload控件的窗体,由于该更新面板,该控件始终返回null。

How can I overcome this issue? 我该如何克服这个问题?

将您的fileuploader和Submit按钮放置在另一个更新面板中,并为此更新面板添加一个回发触发器。

On page load of content page, try to get the update panel of master page using FindControl method and then attach your file upload as a post pack trigger to it dynamically. 在内容页面的页面加载中,尝试使用FindControl方法获取母版页的更新面板,然后将文件上传作为后处理包触发器动态附加到它。 That may work 那可能有效

I've got a bad news for you.! 我对你有个坏消息。

Have a look at this 看看这个

http://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx http://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx

The following ASP.NET controls are not compatible with partial-page updates, and are therefore not supported inside an UpdatePanel control: 以下ASP.NET控件与部分页面更新不兼容,因此在UpdatePanel控件内不受支持:

TreeView and Menu controls. TreeViewMenu控件。

Web Parts controls. Web部件控件。 For more information, see ASP.NET Web Parts Controls. 有关更多信息,请参见ASP.NET Web部件控件。

FileUpload controls when they are used to upload files as part of an asynchronous postback. FileUpload controls何时将它们用作异步回发的一部分来上传文件。

GridView and DetailsView controls when their EnableSortingAndPagingCallbacks property is set to true. GridView and DetailsView controls何时将其EnableSortingAndPagingCallbacks属性设置为true。 The default is false. 默认为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. 验证控件,包括BaseCompareValidator,BaseValidator,CompareValidator,CustomValidator,RangeValidator,RegularExpressionValidator,RequiredFieldValidator和ValidationSummary控件。

Solution : You may want to use Ajax FileUpload using Jquery in place of update Panel. 解决方案:您可能希望使用Jquery使用Ajax FileUpload来代替更新面板。 Remember, Open source is always a better option. 请记住,开源始终是一个更好的选择。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM