Panel hide and show particular interval time using Javascript in Asp.Net C#

Panel hide and show particular interval 

time using Javascript


Using Javascript particular interval Panel Control hide and show in Asp.net c#.

                    DEMO

       
                              

                        HTML CODING


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Panel hide and show particular interval time using Javascript in Asp.Net C#</title>
    <script type="text/javascript">

        function ShowPanel()
        {
            document.getElementById('<%=Panel1.ClientID%>').style.display = "none";
        }
        setTimeout("ShowPanel();", 2000);

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div align="center">
        <asp:Panel ID="Panel1" Visible="false" runat="server" >
            <asp:Label ID="Label5" runat="server" Text="Register Successfully" Font-Size="XX-Large" ForeColor="#FF3300"></asp:Label>
        </asp:Panel>
            <table class="table">

           <tr><td align="center">
             <asp:Label ID="Label4" runat="server" Font-Overline="False" Font-Size="Medium" Text="Name"></asp:Label>
             </td><td>
                 <asp:TextBox ID="txtName" placeholder="Full Name" runat="server" Font-Overline="False" Font-Size="Medium"></asp:TextBox>
             </td></tr>
         <tr><td align="center">
             <asp:Label ID="Label3"  Font-Size="Medium"  runat="server" Text="Email Id"></asp:Label>
             </td><td><asp:TextBox ID="txtEmail"  Font-Size="Medium"  runat="server"></asp:TextBox>
                 <br />
             </td></tr>
                <br />
      <tr>
      <td colspan="2">
       
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       
       <asp:Button ID="Btn_Register" runat="server"  Font-Size="Medium"  Text="Register"
              onclick="Btn_Register_Click"/>
         
      </tr>
     </table>
    </div>
    </form>
</body>
</html>


                  C# CODING

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Activation_link_ : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Btn_Register_Click(object sender, EventArgs e)
    {
        Panel1.Visible = true;      
        System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", " ShowPanel();", true);

    }

}


First - Add New Webform - add interval time for panel using Javascript
          
      

Next - add the button,textbox from toolbox

        

Next call the javascript function from code behind


  

0 comments:

Post a Comment