<script type="text/javascript">
function ShowMessage(message, messagetype) {
debugger;
var cssclass;
switch (messagetype) {
case 'Success':
cssclass = 'alert-success'
break;
case 'Error':
cssclass = 'alert-danger'
break;
case 'Warning':
cssclass = 'alert-warning'
break;
default:
cssclass = 'alert-info'
}
$('#alert_container').append('<div id="alert_div" style="margin: 0 0.5%; -webkit-box-shadow: 3px 4px 6px #999;" class="alert fade in ' + cssclass + '"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a><strong>' + messagetype + '!</strong> <span>' + message + '</span></div>');
//$("#alert_div").fadeTo(5000, 1000).slideUp(1000, function () {
// $("#alert_div").slideUp(1000);
//});
}
aspx.cs page code
protected void btnPnlUpdate_Click(object sender, EventArgs e){
try { string messageType = "Success";
String message = "Successfully Updated...";
ScriptManager.RegisterStartupScript(this, this.GetType(), System.Guid.NewGuid().ToString(), "ShowMessage('" + message + "','" + messageType + "');", true);
}
catch(Exception ex)
{
string messageType = "Error";
String message = "Mail has not send successfully.";
//dvMsg.Visible = true;dvMsg.InnerHtml = "dfdfdf";
lblMsg.Text = "This is notification message demo";
ScriptManager.RegisterStartupScript(this, this.GetType(), System.Guid.NewGuid().ToString(), "ShowMessage('" + message + "','" + messageType + "');", true);
}
}
https://mdbootstrap.com/docs/b4/jquery/javascript/notifications/
No comments:
Post a Comment