Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8663839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:05:20+00:00 2026-06-12T17:05:20+00:00

I got an update panel which contains a gridview and inside each row images

  • 0

I got an update panel which contains a gridview and inside each row images (delete icons) to delete that row. I’m trying to condition that given an answer on a regular JavaScript confirm pop up.

$(function(){
    $("img.delete").on("click", function(evt){ 
        return false; //Does not work
        /*or*/
        evt.preventDefault();//Does not work either
    });
});

Html rendered:

    <td>
        <img id="ctl00_ctl00_ctl00_ctl00_ctl00_ctl00_ContentPlaceHolderDefault_Content_Content_Content_Content_DashboardGrid_ctl02_DeleteControl140" class="delete" onclick="__doPostBack('ctl00$ctl00$ctl00$ctl00$ctl00$ctl00$ContentPlaceHolderDefault$Content$Content$Content$Content$DashboardGrid','Delete$0')" width="20" height="20" title="Remove item from your list." src="/images/delete_item.png" alt="Remove item from your list." style="border-width:0px;">
</td>

It doesn’t work because a postback is always performed by the update panel which has its UpdateMode to its default in the sense that I’m not setting it in the markup.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:05:21+00:00Added an answer on June 12, 2026 at 5:05 pm

    The answer provided by ThiefMaster worked for me, at: preventDefault() doesn't work with a minor tweak for my case:

    function pageLoad() 
    {
      var inlineFunction = new Function($('img.delete').attr('onclick'));
      $('img.delete').click(function(event){
        if(!confirm('Are you sure?')) {
            event.stopImmediatePropagation();         
        }
      }).click(inlineFunction).removeAttr('onclick');
    }
    

    The pageLoad event is available when using updatepanel+scriptmanager which lets me re-attach the event handlers on every partial postback.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a gridview inside an update panel. In the gridview I have an
I have a ASP updatepanel, within that panel I have some controls which got
there are many posts that deal with validation controls inside update panel and partial
I've started working with ASP.net AJAX (finally ☺). and I've got an update panel
I've got an asp.net gridview inside an updatepanel. One of the fields I have
Update: Got this working by disabling CodeIgniter Profiler which was interfering with the Ajax
I've got about 25 tables that I'd like to update with random data that's
In a user control, I've got a Repeater inside of an UpdatePanel (which id
I have an asp.net website which contains a Thread that fetches some data from
I've got an Asp.Net GridView inside an UpdatePanel. It all works fine, except when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.