Making labels appear for seconds and automatically disappear

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>”);
}

Leave a Reply


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.