Making labels appear for seconds and automatically disappear
in the aspx page
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head id=”Head1″ runat=”server”>
<title>Untitled Page</title>
<script type=”text/javascript”>
function TimeOutFuc()
{
var t = setTimeout(”ShowLabel()”,3000);
}
function ShowLabel()
{
var divObj = document.getElementById(’lbl’);
divObj.style.display = ‘none’;
}
</script>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>
</div>
<div id=”lbl” >
<asp:Label ID=”Label1″ runat=”server” ></asp:Label>
</div>
<br />
<asp:Button ID=”Button1″ runat=”server” Text=”Show Label” onclick=”Button1_Click” />
</form>
</body>
</html>
In the code behind page
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = “Some Message”;
Page.RegisterStartupScript(”ShowLbl”, “<script>TimeOutFuc();</script>”);
}
