title: Display div for few seconds and disappear using asp.net code behind
body: <pre><code>protected void Page_Load(object sender, EventArgs e)
          {
              if(!Page.IsPostBack)
                  divStatus.Visible = true;
                  Page.ClientScript.RegisterStartupScript(this.GetType(), "somekey", "function autoHide(){ setTimeout(function() {document.getlementById('" + divStatus.ClientID + "').style.display='none';},5000);};", true); 
          }
  
    &lt;form id="form1" runat="server"&gt;
      &lt;div&gt;
      &lt;div class="success" id="divStatus" runat="server" visible="false" &gt;sssssssssssssssss&lt;/div&gt;
  
      &lt;/div&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>what exactly do i need to add in order to fadeout by itself after few seconds? currently i am displaying div but the user have to click explcitly to close the div and is there a way to close the div by itself using asp.net?</p>
  
  <p>yes i know it does work with fadein and fadeout if you provide the timer but it does not work with asp.net code behind.</p>
  
  <p>//html:</p>
  
  <pre><code> &lt;div class="success" id="divStatus" runat="server" visible="false" &gt;&lt;/div&gt;
  </code></pre>
  
  <p>//code behind:</p>
  
  <pre><code>protected void lnkbtn_add_Click(object sender, EventArgs e)
  {
         ........//more code for deleting
         if (deleted)
         {
             divStatus.visible = true;
         }
  }
  </code></pre>
  
  <p>}</p>