locked
How to Eliminate render-blocking JavaScript and CSS in above-the-fold content from asp:ScriptManager RRS feed

  • Question

  • User-1609411504 posted

    Here is my code

    <asp:ScriptManager ID="ScriptManager1" runat="server" 
                       LoadScriptsBeforeUI="false"
                       EnablePartialRendering="false" EnableCdn="true">
    </asp:ScriptManager>

    I don't understand what I am doing wrong.

    Or is there any possible to add async attribute?

    Any Idea?

    Tuesday, April 19, 2016 3:38 PM

Answers

  • User-2057865890 posted

    Hi mukul.db,

    I don't understand what I am doing wrong.

    If you could provide some error message or more relevant code, it will be easier for us to help you.

    ScriptManager.EnablePartialRendering Property

    Gets or sets a value that enables partial rendering of a page, which in turn enables you to update regions of the page individually by using UpdatePanel controls.

    ScriptManager.LoadScriptsBeforeUI Property

    Gets or sets a value that indicates whether scripts are loaded before or after markup for the page UI is loaded.

    If you want to use ScriptManager control to enable partial-page rendering, you could refer to the follow code snippets.

    <form id="form1" runat="server">
            <asp:ScriptManager ID="MainScriptManager" runat="server" />
            <asp:UpdatePanel ID="pnlHelloWorld" runat="server">
                <ContentTemplate>
                    <asp:Label runat="server" ID="lblHelloWorld" Text="Click the button!" />
                    <br />
                    <br />
                    <asp:Button runat="server" ID="btnHelloWorld" OnClick="btnHelloWorld_Click" Text="Update label!" />
                </ContentTemplate>
            </asp:UpdatePanel>
        </form>
    
    code behind:
    
    protected void btnHelloWorld_Click(object sender, EventArgs e)
    {
        lblHelloWorld.Text = "Hello, world - this is a fresh message from ASP.NET AJAX!The time right now is: " +         DateTime.Now.ToLongTimeString();
    }

    Best Regards,

    Chris

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 22, 2016 6:20 AM