我有一个更新面板,其中包含一个 gridview 并在每行图像(删除图标)内删除该行。我正在尝试在常规 JavaScript 确认弹出窗口中给出答案。
$(function(){
$("img.delete").on("click", function(evt){
return false; //Does not work
/*or*/
evt.preventDefault();//Does not work either
});
});
呈现的 HTML:
<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>
它不起作用,因为回发总是由更新面板执行,该面板将其 UpdateMode 设置为默认值,因为我没有在标记中设置它。