Saturday, July 10, 2010

How to auto update a segment a page - Asp.net

<%@ Page Language="C#" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <style type="text/css">
        .Hide {display:none; }
    </style>
    <script runat="server">
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            ScriptManager.RegisterStartupScript(
                thisthis.GetType(), 
                this.GetType().Name, 
                string.Format("setTimeout(\"__doPostBack('{0}','')\", 5000)", 
                this.btnPostback.UniqueID), 
                true);
            this.lblUpdatedOn.Text = DateTime.Now.ToString("hh:mm:ss");            
        }
        protected void AutoPostback(object sender, EventArgs e)
        {
        }
    </script>
</head>
<body>
    
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <asp:UpdatePanel runat="server" ID="upnlCascadeDropdown">
             <ContentTemplate>
                Last Updated on: <asp:Label runat="server" ID="lblUpdatedOn" />
                <asp:Button CssClass="Hide" 
                    runat="server" 
                    ID="btnPostback" 
                    OnClick="AutoPostback" 
                    UseSubmitBehavior="false" />
             </ContentTemplate>
        </asp:UpdatePanel>
    </form>
</body>
</html>

No comments:

iPhone Launch Screen Sizes

iPhone Portrait iOS 8 Retina HT 5.5 = 1242 X 2208 Retna HD 4.7 = 750 X 1134 iPhone Landscape iOS 8 Retina HD 5.5  2208 X 1242 iPho...