Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Update Panel

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 249
    Comment on it

    Update Panel

    An Update Panel is a control used to refresh selected parts of the page instead of refreshing the whole page with a post back. This is referred as performing a partial-page update.

    An Update Panel has two child tags.
    1: ContentTemplate
    2: Triggers

    An UpdatePanel has a property called UpdateMode.
    There are two possible values for this property:
    1) Always (By default)
    2) Conditional

    If the Update Mode property is set to "Always", the Update Panel controls content is updated on each postback which starts from anywhere on the webpage. This also includes asynchronous postbacks from controls that are inside other Update Panel controls, and postbacks from controls which are not inside Update Panel controls.

    If the Update Mode property is set to Conditional, the Update Panel controls content is updated when one of the following is true:

    1 - When the postback is caused by a trigger for that UpdatePanel control.
    2 - When you explicitly call the UpdatePanel control's Update() method.
    3 - When the UpdatePanel control is nested inside another UpdatePanel control then the parent panel is updated.

    When the ChildrenAsTriggers property is set to true and any child control of the UpdatePanel control causes a postback. Child controls of nested UpdatePanel controls do not cause an update to the outer UpdatePanel control unless they are explicitly defined as triggers for the parent panel.

    Controls defined inside a node have the capability to update the contents of an UpdatePanel. If the ChildrenAsTriggers property is set to false and the UpdateMode property is set to Always, an exception is thrown. The ChildrenAsTriggers property is intended to be used only when the UpdateMode property is set to Conditional.

    UpdateProgress

    The UpdateProgress control provides status information about partial-page updates in UpdatePanel controls. If a page contains UpdatePanel controls, you can also include UpdateProgress controls to keep users informed about the status of partial-page updates. We can use one UpdateProgress control to represent the progress of partial-page updates for the whole page.

    Example

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>AJAX - UpdateProgress</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <asp:ScriptManager ID="ScriptManager1" runat="server" />
                <asp:UpdatePanel runat="server" ID="UpdatePanel" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:Label runat="server" ID="DateTimeLabel1" />
                        <asp:Button runat="server" ID="UpdateButton1" OnClick="UpdateButton&#95;Click" Text="Update" />
                    </ContentTemplate>
                </asp:UpdatePanel>
                <asp:UpdateProgress runat="server" ID="PageUpdateProgress">
                    <ProgressTemplate>
                        Loading...
                    </ProgressTemplate>
                </asp:UpdateProgress>
            </div>
        </form>
    </body>
    </html>
    
    protected void UpdateButton_Click(object sender, EventArgs e)
    {
            System.Threading.Thread.Sleep(3000);
            DateTimeLabel1.Text = DateTime.Now.ToString();
    }
    

    For further reference please vist the below link: dotnetspider

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: