Confirm box always displays first (javascript, jQuery, .Net)
- by Jan-Frederik Carl
Hello,
I have a jQuery-Script to accomplish the following tasks:
if a gridview in my form contains a row with a certain id, it has to be
marked red.
a confirm dialogue has to pop up to ask the user if he wants to do this or that.
I built this code:
if (response == "EntryInList") {
$('#entryListContainer div table tbody tr').each(function() {
if ($(this).attr('id') == 'entry_' + $('#<%= txtProductNumber.ClientID %>').val()) {
$(this).css("color", "red");
}
}
);
if (!confirm("Entry already exists. Really overwrite?")) {
jQuery('#<%= txtProductNumber.ClientID %>').val('');
jQuery('#<%= txtCount.ClientID %>').val('');
jQuery('#<%= txtProductNumber.ClientID %>').focus();
return false;
}
}
As a result, the confirm box pops up first, without the row being turned red. Only after
using the box, it becomes red. How would I get the row to be turned red at once?
Another of my problems is that the confirm box denies my page to be scrolled down. But
I would like to do this if the gridview is longer than the entire page.