Displaying message while postback

Hi,

How can I display a message to the user while data control (e.g. Grigview, Formview) is populating from server ?

Thanks,

You’ll need to populate your gridview using ajax, updatepanel etc so the work can happen after the actual page has loaded, this lets you show a message until the ajax work has finished.  Or you can show a "please wait" page that redirects to your actual
page so the browser shows the waiting page until the actual page has returned from the server.

Hi shtrudel,

Thanks for your post.

The UpdateProgress control could provide status information about partial-page updates in UpdatePanel controls, and you can customize the default content and the layout of the UpdateProgress control. So you could use UpdateProgress control  to show that
an asynchronus method is working.

For more information about UpdateProgress Control, you could refer to the following link.

Besides, you could refer to this sample.

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        #UpdatePanel1, #UpdateProgress1 {
            border-right: gray 1px solid;
            border-top: gray 1px solid;
            border-left: gray 1px solid;
            border-bottom: gray 1px solid;
        }

        #UpdatePanel1 {
            width: 200px;
            height: 200px;
            position: relative;
            float: left;
            margin-left: 10px;
            margin-top: 10px;
        }

        #UpdateProgress1 {
            width: 400px;
            background-color: #FFC080;
            bottom: 0%;
            left: 0px;
            position: absolute;
        }
    </style>


    <script runat="server">
        protected void Button_Click(object sender, EventArgs e)
        {
            System.Threading.Thread.Sleep(3000);
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div>
            <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
                <ContentTemplate>
                    <%=DateTime.Now.ToString() %>
                    <br />
                    <asp:Button ID="Button1" runat="server" Text="Refresh Panel" OnClick="Button_Click" />
                </ContentTemplate>
            </asp:UpdatePanel>

            <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                <ProgressTemplate>
                    Update in progress...
                </ProgressTemplate>
            </asp:UpdateProgress>

        </div>
    </form>
</body>
</html>

Hope it will be helpful to you.

Best Regards,

Fei Han

Thank you for your answers,

I prefer not to use the ajax controls… maybe because I do not really understand what’s behind the scene’s

shtrudel

I prefer not to use the ajax controls

You are going to have to use some kind of AJAX-enabled approach to do what you want. If you prefer not to use the AJAX controls, you can use jQuery. 

Leave a Reply