切换到FormViewMode.Edit非常慢

时间:2010-06-16 11:08:40

标签: .net asp.net performance asp.net-ajax formview

当我将ASP.Net Formview从只读模式切换到编辑模式时,它需要6秒以上(从编辑到只读需要一瞬间)。 我不知道它的原因是什么。 EditItemTemplate包含许多控件(表,文本框,下拉列表),但实际上不超过ItemTemplate。然而,我甚至已经注释掉了完整的FormView.DataBound,其中控件是数据有限但没有重大变化。我的ASP.Net Web Apllication使用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)版本时,它的执行速度几乎与没有扩展器控件一样快。

2 个答案:

答案 0 :(得分:1)

实际上我的问题是,我在我的项目(3.0x)中有一个旧的AjaxControlToolkit.dll引用。当我删除它并添加较新的(3.5x)版本时,它的执行速度几乎与没有扩展器控件一样快。

答案 1 :(得分:0)

当它们不在视图中时,AJAX控件可能无法加载脚本或自行注册,因此当您使用控件内联进入编辑模式时,所有这些都会发生...我还没试过这个控制,但这似乎在逻辑上是为什么会发生这种情况。

每个AJAX控件都会经历一个初始化过程(所有$ create客户端方法调用),这可能需要一段时间......

HTH。