Peter
Peter

Reputation: 87

How to display a button after 5 minutes in ASP.net (.aspx)?

I am fairly new to the ASP.NET so is there a way to make a button visible after a certain time?

<asp:Button   ID="Button1" runat="server" Text="Click here"  OnClick="btn_Click" Visible="False" /> 

Code-behind:

protected void btn_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/site...." );
        }

Upvotes: 2

Views: 323

Answers (1)

Reza Jenabi
Reza Jenabi

Reputation: 4269

I think the following code can help you:

<script type="text/javascript">

    function show()
    {
        document.getElementById("Button1").style.visibility = "visible";
    }

    function hide()
    {
        document.getElementById("Button1").style.visibility = "hidden";
    }

    window.onload = function()
    {
        hide();
        setTimeout('show()', 30000);
    }

</script>

the code at the bottom of the page to run after the page is created

Upvotes: 6

Related Questions