Hi Julia,
If you set the image button's enabled property to false, the cursor should
stay at the default.
In a user control, you have to get a reference to the image button. Here's
some sample code (ASP.NET 2.0) in case it helps.
Let us know how you make out?
Ken
Microsoft MVP [ASP.NET]
' --imgbtn.ascx--
<%@ control classname="usrimgbtn" language="VB" %>
<asp:imagebutton id="ImageButton1" runat="server"
imageurl="
http://www.gc.ca/images/flag.gif" /><br />
<br />
<asp:label id="lblEnabled" runat="server"></asp:label>
'-- imgbtncursor.aspx--
<%@ Page Language="VB" %>
<%@ register src="imgbtn.ascx" tagname="imgbtn" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub btnEnableDisable_Click _
(ByVal sender As Object, ByVal e As System.EventArgs)
Dim uc As UserControl
Dim imgbtn As ImageButton
Dim lbl As Label
uc = Page.FindControl("Imgbtn1")
If Not IsNothing(uc) Then
imgbtn = uc.FindControl("ImageButton1")
lbl = uc.FindControl("lblEnabled")
imgbtn.Enabled = Not imgbtn.Enabled
lbl.Text = imgbtn.Enabled.ToString
btnEnableDisable.Text = _
IIf(imgbtn.Enabled, "Disable", "Enable")
End If
End Sub
</script>
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Enable Disable button</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
<uc1:imgbtn id="Imgbtn1" runat="server" />
<br />
<br />
<asp:button id="btnEnableDisable" runat="server"
onclick="btnEnableDisable_Click" text="Disable" /> </div>
</form>
</body>
</html>
Julia said:
Hi
I have developed a composite control containing an ImageButton. The user
can
only press the ImageButton at some point. I would like to make the cursor
of
the ImageButton normal all the time the ImageButton is not possible to
press.
How do I do that?
Thanks in advance
Julia