Confirm box always displays first (javascript, jQuery, .Net)
Posted
by Jan-Frederik Carl
on Stack Overflow
See other posts from Stack Overflow
or by Jan-Frederik Carl
Published on 2010-06-10T09:24:10Z
Indexed on
2010/06/10
9:32 UTC
Read the original article
Hit count: 243
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.
© Stack Overflow or respective owner