Hiding label message after a time interval in Asp.Net from code behind through JavaScript

12 Sep 2016 vikram singh
0 Comments 2538 Views

Here we explain how to hide label messages after your defined time interval in Asp.Net using JavaScript.


Sometimes you may need to hide the label message from code behind, In scenerios such as after insertion or updating etc. just try this code below your message lable.

lbl_ErrorMsg.text = "Data Saved Successfully";

ClientScript.RegisterStartupScript(this.GetType(), "HideLabel", "setTimeout(\"document.getElementById('" + lblMsg.ClientID + "').style.display='none'\",5000)");

Here this Code will make disappear your label message after 5 seconds. If you want to change time interval, just change the 5000 to your desired time interval. this is in nanoseconds format.

vikram singh

I am developer with 3+ years exp. in, jquery, javascript,SQL area knowledege.


No coments found to display!

Leave a Comment