切换到 FormViewMode.Edit 非常慢
当我将 ASP.Net Formview 从只读模式切换到编辑模式时,需要超过 6 秒的时间(从编辑到只读只需要一瞬间)。 我不知道原因是什么。 EditItemTemplate 包含很多控件(表格、文本框、下拉列表),但实际上并不比 ItemTemplate 多。然而,我什至注释掉了完整的 FormView.DataBound,其中控件受数据限制,但没有重大更改。我的 ASP.Net Web 应用程序使用 Ajax,并且 Formview 完全嵌套在 UpdatePanel 中。 对于这种行为有什么建议或假设吗?
编辑: 我已经从 EditItemtemplate 中删除了所有 Ajax 控件,现在它的执行速度与 Itemtemplate 一样快。可能是什么原因呢?删除了以下控件:
<act:ValidatorCalloutExtender ID="NoDeliveryNoteValidatorExtenderEdit" BehaviorID="NoDeliveryNoteValidatorExtenderEdit" runat="server" TargetControlID="NoDeliveryNoteValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="NoArrivalAtValidatorExtenderEdit" BehaviorID="NoArrivalAtValidatorExtenderEdit" runat="server" TargetControlID="NoArrivalAtValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="ArrivalAtValidatorExtenderEdit" BehaviorID="ArrivalAtValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="ArrivalAtValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="NoPalletCountValidatorExtenderEdit" BehaviorID="NoPalletCountValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="NoPalletCountValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="PalletCountIntegerValidatorExtenderEdit" BehaviorID="PalletCountIntegerValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="PalletCountIntegerValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="NoWeightInValidatorExtenderEdit" BehaviorID="NoWeightInValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="NoWeightInValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="WeightInIntegerValidatorExtenderEdit" BehaviorID="WeightInIntegerValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="WeightInIntegerValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="WeightOutIntegerValidatorExtenderEdit" BehaviorID="WeightOutIntegerValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="WeightOutIntegerValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="NoCountInValidatorExtenderEdit" BehaviorID="NoCountInValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="NoCountInValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="CountInIntegerValidatorExtenderEdit" BehaviorID="CountInIntegerValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="CountInIntegerValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="CountOutIntegerValidatorExtenderEdit" BehaviorID="CountOutIntegerValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="CountOutIntegerValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="NoRecipientValidatorExtenderEdit" BehaviorID="NoRecipientValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="NoRecipientValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="NoChargeTypeValidatorExtenderEdit" BehaviorID="NoChargeTypeValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="NoChargeTypeValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="NoCustomerValidatorExtenderEdit" BehaviorID="NoCustomerValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="NoCustomerValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:CalendarExtender ID="ArrivalAtExtenderEdit" runat="server" BehaviorID="ArrivalAtExtenderEdit" TargetControlID="TxtArrivalAtEdit"></act:CalendarExtender>
所以看来我应该将此线程重命名为“ASP.NET AJAX:扩展器控件的性能问题”。
实际上我的问题是,我在我的项目(3.0x) 中有一个对 AjaxControlToolkit.dll 的旧引用。当我删除它并添加较新的(3.5x)版本时,它的执行速度几乎与没有扩展器控件一样快。
When i switch an ASP.Net Formview from readonly mode to edit mode it takes more than 6 seconds(from edit to readonly takes a split second).
I have no idea whats the reason for it. The EditItemTemplate contains a lot of controls(table,textboxes,dropdownlists) but in fact not more than the ItemTemplate has. Yet i have even commented out the complete FormView.DataBound where the controls are data bounded but without significant change. My ASP.Net Web Apllication is using Ajax and the Formview is completely nested in an UpdatePanel.
Any suggestions or assumptions for this behaviour?
EDIT:
I have removed all Ajax Controls from the EditItemtemplate and now it performs as fast as the Itemtemplate. What can be the reason for it? Following controls removed:
<act:ValidatorCalloutExtender ID="NoDeliveryNoteValidatorExtenderEdit" BehaviorID="NoDeliveryNoteValidatorExtenderEdit" runat="server" TargetControlID="NoDeliveryNoteValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="NoArrivalAtValidatorExtenderEdit" BehaviorID="NoArrivalAtValidatorExtenderEdit" runat="server" TargetControlID="NoArrivalAtValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="ArrivalAtValidatorExtenderEdit" BehaviorID="ArrivalAtValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="ArrivalAtValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="NoPalletCountValidatorExtenderEdit" BehaviorID="NoPalletCountValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="NoPalletCountValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="PalletCountIntegerValidatorExtenderEdit" BehaviorID="PalletCountIntegerValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="PalletCountIntegerValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="NoWeightInValidatorExtenderEdit" BehaviorID="NoWeightInValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="NoWeightInValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="WeightInIntegerValidatorExtenderEdit" BehaviorID="WeightInIntegerValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="WeightInIntegerValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="WeightOutIntegerValidatorExtenderEdit" BehaviorID="WeightOutIntegerValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="WeightOutIntegerValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="NoCountInValidatorExtenderEdit" BehaviorID="NoCountInValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="NoCountInValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="CountInIntegerValidatorExtenderEdit" BehaviorID="CountInIntegerValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="CountInIntegerValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="CountOutIntegerValidatorExtenderEdit" BehaviorID="CountOutIntegerValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="CountOutIntegerValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="NoRecipientValidatorExtenderEdit" BehaviorID="NoRecipientValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="NoRecipientValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="NoChargeTypeValidatorExtenderEdit" BehaviorID="NoChargeTypeValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="NoChargeTypeValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:ValidatorCalloutExtender ID="NoCustomerValidatorExtenderEdit" BehaviorID="NoCustomerValidatorExtenderEdit" PopupPosition="right" runat="server" TargetControlID="NoCustomerValidatorEdit" Width="150px" HighlightCssClass="highlight" WarningIconImageUrl="~/images/warning.gif" CloseImageUrl="~/images/close.gif" />
<act:CalendarExtender ID="ArrivalAtExtenderEdit" runat="server" BehaviorID="ArrivalAtExtenderEdit" TargetControlID="TxtArrivalAtEdit"></act:CalendarExtender>
So it seems that i should rename this thread to "ASP.NET AJAX: Performance issues with extender controls".
Actually my problem was, that i had an old reference to AjaxControlToolkit.dll in my Project(3.0x). When i removed it and added the newer (3.5x) Version it performed nearly as fast as without the Extender Controls.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实际上我的问题是,我的项目(3.0x)中有一个对 AjaxControlToolkit.dll 的旧引用。当我删除它并添加较新的(3.5x)版本时,它的执行速度几乎与没有扩展器控件一样快。
Actually my problem was, that i had an old reference to AjaxControlToolkit.dll in my Project(3.0x). When i removed it and added the newer (3.5x) Version it performed nearly as fast as without the Extender Controls.
当它们不在视图中时,AJAX 控件可能不会加载其脚本,也不会自行注册,因此当您使用内联控件进入编辑模式时,所有这一切都会发生...我还没有尝试过使用此控件,但是从逻辑上讲,这似乎就是发生这种情况的原因。
每个 AJAX 控件都会经历一个初始化过程(所有 $create 客户端方法调用),这可能需要一段时间......
HTH。
When they are out of view, its possible that the AJAX controls do not load their scripts nor register themselves, thus all of this happens when you go to edit mode with the controls inline... I have not tried this with this control, but that would seem to be logically why that happens.
Each AJAX control goes through an initialization process (all the $create client-side method calls) and maybe that is taking a while...
HTH.