This is a migrated thread and some comments may be shown as answers.

[Solved] Customize alert in confirmation delete in mvc grid

2 Answers 270 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Beni
Top achievements
Rank 1
Beni asked on 02 Feb 2012, 01:28 PM
Hello.

I'm using MVC grid and it works great, but I need to customize the alert (confirmation window) that appears when pressing the delete button in Ajax edit mode. I'm not talking about just the message, I would like to use products like

jAlert

or

Custom alert using jScript and the dom

I've tried this, seen on another post in this forum:

function replaceConfirmation(e) {
    var grid = $(this).data('tGrid');
    $(this).find('.t-grid-delete').click(function (e) {
        var tr = $(this).closest('tr');
        //grid.localization.deleteConfirmation = 'Delete row #' + tr.index() + '?';
        jAlert('This is a custom alert box', 'Alert Dialog');
    });
}

But the grid always shows it's own alert, so I'm showing two windows instead of one. Another solution would be to use Telerik Window control, but I guess the problem would be the same: the grid control will show it's own alert.

Is there a way to change this, customize the alert or just to avoid the grid control to shows the window so I'll be able to show mine?

Thank you very much.

2 Answers, 1 is accepted

Sort by
0
nachid
Top achievements
Rank 1
answered on 03 Feb 2012, 07:57 AM
If you're lucky, adding
e.preventDefault();
to you function should prevent the click event from bulbing up
0
Beni
Top achievements
Rank 1
answered on 03 Feb 2012, 01:00 PM
Hi nachid, thanks for answering.

I tried

e.preventDefault(); 

in my 

function replaceConfirmation(e) {}

function but it doesn't work. The only think to avoid the popup is returning a false value at the end of the function and before show my own alert, but if I need to use a confirm window and the function always returns a false value, how can I capture what the user answer?
Tags
Grid
Asked by
Beni
Top achievements
Rank 1
Answers by
nachid
Top achievements
Rank 1
Beni
Top achievements
Rank 1
Share this question
or