当我将 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) 版本时,它的执行速度几乎与没有扩展器控件时一样快。