I am working on a asp.net project. It is not a MVC project. I have a requirement to display status messages (save succesful, save failed etc) some where on the page. I am using bootstrap alerts to display the same. I am using the below code to display the alerts.
<div class = "row" style="margin:0 2px 0 2px" >
<div class="col-md-12" id="AlertNotificationDiv" runat="server">
<asp:Label id="AlertNotificationBox" runat="server"/>
</div>
</div>
On the code behind file I am using the following code to set the alerts
if (!AlertNotificationDiv.Visible)
AlertNotificationDiv.Visible = true;
if (!AlertNotificationBox.Visible)
AlertNotificationBox.Visible = true;
AlertNotificationDiv.Attributes.Add("class", "col-md-12 col-xs-12 col-ms-12 alert alert-success alert-dismissable");
AlertNotificationBox.Text = "Some message comes here";
Is this fine or is there any better way to handle the scenario. The problems I am facing with this approach is. 1. I am not able to provide a functionality where in the alert closes in about 5 sec. With some code I was able to hide the the alert after a few seconds, but if there is any post back for any other action it is appearing again.
Can somebody tell me as to how I can make this alert go after a few seconds and it does not come again until I explicitly make the visibility to true.
Thanks in advance.