我在中继器中有许多ImageButton,根据每条记录,这些图像中的一些将是可单击的,而另一些则已禁用,以停止回发。
我现在更改了每个图像的不透明度,以便除非您将鼠标悬停在该图像按钮上,否则它将为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";
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句