A question has been updated.
Reference:
The following HTML link "Add Regular" is functioning correctly. When clicked, it displays the notification showing that the related .js and .css files are working.
HTML Link
<a href="#" id="add-regular">Add regular notification</a>
JavaScript
<script type="text/javascript">
$('#add-regular').click(function () {
var unique_id = $.gritter.add({
// (string | mandatory) the heading of the notification
title: 'This is a regular notice!',
// (string | mandatory) the text inside the notification
text: 'This will fade out after a certain amount of time.',
// (string | optional) the image to display on the left
image: '/content/gritter/images/success.png',
// (bool | optional) if you want it to fade out on its own or just sit there
sticky: false,
// (int | optional) the time you want it to be alive for before fading out
time: '',
class_name: 'gritter-info'
});
return false;
});
</script>
I have converted the above JavaScript into a function with parameters, and I am attempting to call it from the code-behind (ASP.NET / Web Forms) to show the notification, but it is not functioning as intended!
Codebehind
Page.ClientScript.RegisterStartupScript(Me.GetType(), "return", "stickyalert('Property Upload', 'property data uploaded successfully', 0, 'success');", True)
JavaScript
<script type="text/javascript">
function stickyalert(title, text, sticky, success) {
var unique_id = $.gritter.add({
// (string | mandatory) the heading of the notification
title: title,
// (string | mandatory) the text inside the notification
text: text,
// (string | optional) the image to display on the left
image: '/content/gritter/images/success.png',
// (bool | optional) if you want it to fade out on its own or just sit there
sticky: sticky,
// (int | optional) the time you want it to be alive for before fading out
time: '5000',
// (string | optional) the class name you want to apply to that specific message
class_name: 'gritter-info'
});
return false;
}
</script>