jQuery Toast Notification
<link media="screen" rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.0.1/js/toastr.js"></script>
var toastrOptions = {
"closeButton": true,
"debug": false,
"newestOnTop": false,
"progressBar": true,
"positionClass": "toast-top-right",
"preventDuplicates": true,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "12000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
function showNotification(msg, title) {
toastr.options = toastrOptions;
toastr.success(msg, title);
return false;
}
function showError(msg, title) {
toastr.options = toastrOptions;
toastr.error(msg, title);
return false;
}
C#
objectname.ShowMessageError(this, "Please Select Route Name");
Sub ShowMessageError(ByVal Page As Page, ByVal Message As String)
Page.ClientScript.RegisterStartupScript(Me.GetType(), "Error", "<script>showError('" & Message & "', 'Error')</script>")
End Sub
Sub ShowMessageSuccess(ByVal Page As Page, ByVal Message As String)
Page.ClientScript.RegisterStartupScript(Me.GetType(), "Success", "<script>showNotification('" & Message & "', 'Success')</script>")
End Sub
0 Comments