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);
}
<form id="form1" runat="server">
<div>
<div class="success" id="divStatus" runat="server" visible="false" >sssssssssssssssss</div>
</div>
</form>
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?
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.
//html:
<div class="success" id="divStatus" runat="server" visible="false" ></div>
//code behind:
protected void lnkbtn_add_Click(object sender, EventArgs e)
{
........//more code for deleting
if (deleted)
{
divStatus.visible = true;
}
}
}
See Question&Answers more detail:os