views:

503

answers:

1

I need to show a reminder as floating popup/alert in my asp.net mvc (C#) application.

When the user has any information from the admin that should be notified at particular time, i need to show it as floating popup/alert in the user's screen.

For ex.: When the admin sets an alert "Payment due last date is 15-Oct-2009" to notify the user on "12-Oct-2009 10:00 AM". Then it should show the alert to the user on "12-Oct-2009 10:00 AM" as "Payment due last date is 15-Oct-2009".

Is there any simple way to do this?

A: 

Well don't know how simple is it, but you could use the JQuery Timer plugin, to start a timer that is going to run once in a while and make an ajax call to check if there is an alert that user need to be informed about.

So when admin sets the payment I would just submit it in the database. The function to which you are going to make an ajax call will check if there is any payment that reached the alert datetime. That function can return a JSON object with all needed information to show in the popup.

$(document).everyTime(10000, function(i) {

$.ajax({
    type: "POST",
    url: "controller/CheckTimerAction",
    dataType:"json",
    error: function(xhr, status, error) { },
    success: function(response) {

        if (response.AlertExist) {
            var dialog = $('#dialog');

            dialog.html(response.AlertInfo);
            dialog.dialog('option', 'width', '50%');
            dialog.dialog('open');
        }
    }
});});

There is the Dialog jquery plugin that can help you to show modal popup dialog.

Misha N.
Thanks misha, i'll look at this
Prasad
No problem, I added a bit of code to explain what did I mean better.
Misha N.
Its really great and worked as i like
Prasad