我在转发器中有许多 ImageButtons,根据每条记录,这些图像中的一些将是可点击的,而其他图像,我已禁用停止回发的按钮。
我现在已经更改了每个图像的不透明度,除非您将鼠标悬停在该图像按钮上,否则它将为 0.6。问题是,对于我禁用的那些,显然我不能改变不透明度开/关悬停。
目前我正在这样做:
if (vessel.IsRegistered)
{
imagebuttonRegistration.ImageUrl = ("../Images/Icons/registrationApproved.gif");
imagebuttonRegistration.CommandArgument = null;
DisableImageButton(imagebuttonRegistration);
imagebuttonRegistration.ToolTip = GetLocalResourceObject("imageButRegistrationRegisteredText").ToString();
}
public static void DisableImageButton(ImageButton imagebutton)
{
imagebutton.Attributes.Remove("href");
imagebutton.Attributes.Add("disabled","disabled");
}
但由于禁用按钮现在给我带来了问题,我如何才能停止按钮可点击/无回发但允许使用其他属性。
请您参考如下方法:
使用 Css 的不同方式:
在你的css文件中添加:
.notclickable{
cursor:text;
}
并在 DisableImageButton 方法中添加:
imagebutton.Attributes["class"] ="notclickable";
