[Tips]AjaxToolKit Part Hacks

It has been existed for a long time. however, i would like to make a collection for later check. This tip is written in english, because, i feel a little tired and sort of unwilling to speak.

1. Performance Improvement

a. Remove Uesless HttpModules

Full HttpModules list located in C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config

<httpModules>
            <add name="OutputCache" type="System.Web.Caching.OutputCacheModule"/>
            <add name="Session" type="System.Web.SessionState.SessionStateModule"/>
            <add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule"/>
            <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule"/>
            <add name="PassportAuthentication" type="System.Web.Security.PassportAuthenticationModule"/>
            <add name="RoleManager" type="System.Web.Security.RoleManagerModule"/>
            <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule"/>
            <add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule"/>
            <add name="AnonymousIdentification" type="System.Web.Security.AnonymousIdentificationModule"/>
            <add name="Profile" type="System.Web.Profile.ProfileModule"/>
            <add name="ErrorHandlerModule" type="System.Web.Mobile.ErrorHandlerModule, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
            <add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
        </httpModules>

You could make your own httpmodule list by setting in the HttpModules Section in web.config

<httpModules>
            <!-- Remove the modules which will not be used then, for a better performance -->
            <!--remove name="WindowsAuthentication"/-->
            <remove name="PassportAuthentication"/>
            <remove name="FileAuthorization"/>

Caching, ProcessModel Detailed Setting.

See Full Guide: Improving .NET Application Performance and Scalability

b. Setting Properties to ScriptManager and UpdatePanel

<asp:ScriptManager ID="ScriptManager1" AsyncPostBackTimeout="36000" EnablePartialRendering="true" runat="server" LoadScriptsBeforeUI ="false" ScriptMode="Release"  />

Set the UpdateModel to UpdatePanel, Conditional will help a lot

2. Brower Compatibility

For IE 6

a. part of the background is white:

Add a style to the target CssClass

    position: absolute;
   top: expression(eval(document.documentElement.scrollTop) + "px");

b. Accordion Can not run

check the security setting of you internet explorer. For IE6: the security need to be medium or even lower.

SecuritySettingOfIE6

For IE6/IE7

a.  When the page first load, the ModalPopUp Panel rather than hide, it appear once, then hide

add style="display: none" in panel label.

Notice: do it in the panel label <asp:Panel Id="xxx" style="display: none" runat="server" />

3. Add A Loading apperance which make the page gray or transport, and set the cursor to wait.

Add the script below to the page

<script type="text/javascript">
        var prm = Sys.WebForms.PageRequestManager.getInstance(); ;
        prm.add_initializeRequest(InitializeRequest);
        prm.add_endRequest(EndRequest);

        //hook into InitializeRequest
        function InitializeRequest(sender, args) {

            // Get a reference to the element that raised the postback,
            //   and disables it.
            // $get(args._postBackElement.id).disabled = true;
            document.body.className = "Progressing";
        }

        //hook into the EndRequest event
        function EndRequest(sender, args) {
            // $get(args._postBackElement.id).disabled = false;
            document.body.className = "ProgressComplete";

        }

</script>

Css Style

.Progressing
{
    filter: gray;
    cursor: wait;
}

.ProgressComplete
{
    cursor: auto;
}

posted on 2008-10-28 18:15  xwang  阅读(280)  评论(0编辑  收藏  举报

导航