且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

与警报禁用的按钮是点击IE8中(浏览器兼容性问题在Asp.net网站)

更新时间:2023-10-04 09:07:04

为什么不合并的ImageButton 的宗旨与的LinkBut​​ton ? (反之亦然...)

 < ASP:LinkBut​​ton的=服务器ID =lBtnDeleteUser的OnClick =lBtnDeleteUser_Click
的OnClientClick =返回确认(你确定要删除这个用户?)'
风格=显示:块;背景图像:网址(样式/图像/ icon_delete.png');
宽度:widthOficon_delete.pngInPixels;高度:heightOficon_delete.pngInPixels;
工具提示=删除/>

I have disabled a link button and image button(which is inside a link button so that I can show a Alert) and it works fine in Chrome, but when I open it in IE8 the image is disabled but when i click it it shows the popup('Are you sure you want to delete this User?'). Why am I getting this error in IE8 and IE7, how can I fix this.

  <asp:LinkButton ID="lnk_DeleteUser" Enabled="false" 
    ToolTip="Delete" runat="server" 
   OnClientClick="return confirm('Are you sure you want to delete this User?')">
  <asp:ImageButton ID="Img_del" Enabled="false" 
      src="Styles/Images/icon_delete.png" 
      OnClick="imgbtn_UserDeleteClick"                                            
     runat="server" Style="border-style: none" alt="Delete User" /></asp:LinkButton>

Code from view source:

 <a onclick="return confirm(&#39;Are you sure you want to delete this User?&#39;);"
 id="ctl00_MainContent_UserTable_ctl02_lnk_DeleteUser" title="Delete User" 
class="aspNetDisabled"><input type="image" name="ctl00$MainContent$UserTable$ctl02
$Img_del" id="ctl00_MainContent_UserTable_ctl02_Img_del" disabled="disabled" 
title="You don&#39;t have permission to delete users" class="aspNetDisabled" 
src="Styles/Images/icon_delete.png" alt="Delete User" src="" 
style="border-style: none" /></a>

Why not merge the ImageButtons purpose with the LinkButton? (or vice versa...)

<asp:LinkButton runat="server" ID="lBtnDeleteUser" OnClick="lBtnDeleteUser_Click"
OnClientClick='return confirm("Are you sure you want to delete this User?")'
style="display: block; background-image: url('Styles/Images/icon_delete.png');
width: widthOficon_delete.pngInPixels; height: heightOficon_delete.pngInPixels;"
ToolTip="Delete" />