improved ImageButton does it exist?

F

Franck

Heelo,
I'm looking for a component that allow creating
a ImageButton slighlty imporved as
I wish It could change backggrtound image
with the following event;
onMouseOut onMouseOver onClick

I've done it done it that way using javascirpt in the html code:
-----------------------------------------------------
<a id="A1" href="#"
onMouseOut="MM_nbGroup('out');"
onMouseOver="MM_nbGroup('over','ImageButton1','bouton_f2.gif','bouton_f3.gif',1);"
onClick="MM_nbGroup('down','navbar1','ImageButton1','bouton_f3.gif',1);">

<asp:ImageButton id="ImageButton1" style="Z-INDEX: 102; LEFT: 224px;
POSITION: absolute; TOP: 16px" runat="server" ImageUrl="bouton.gif">

</asp:ImageButton>

</a>
-----------------------------------------------------

but I imagine this control must exist somewhere?

Any help?

Thanks

Franck
 
B

Bruce Barker

pretty trival to write. inherit from ImageButton, add a RolloverImageUrl
property (to set the rollover image), then in the render:


public class RolloverImageButton : ImageButton
{
string mRolloverImageUrl = "";

public string RolloverImageUrl
{
get {return mRolloverImageUrl ; }
set {mRolloverImageUrl = value; }
}

protected override void Render(HtmlTextWriter output)
{
if (RolloverImageUrl.Length > 0)
{
this.Attributes.Add("onmouseout",string.Format("this.src='{0}',ImageUrl));
this.Attributes.Add("onmouseover",string.Format("this.src='{0}',RolloverImageUrl));
}
base.Render(output);
}
}


-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top