Home All Groups Group Topic Archive Search About

making image click fire codebehind function?

Author
5 Feb 2006 3:06 AM
simon
have an image (acting like a button) currently that has onMouseOver
and onMouseOut events.  want to make this accessible to the codebehind
with a click event.
was able to right click at and choose "run as server control", when i
double click it then to put code in the codebehind, there is no
function there for me to fill in.  i made up one called goButton_Click
and handles gobutton.click
that didn't work, didn't recognize the name i gave it or click event
(don't remember which). 
if i was to change it to a vb.net imagebutton, then i'd loose the
onMouseOver and onMouseOut events.

is there a way to have an image have the onMouse events and upon
clicking be handled by a codebehind function?  i'm sure there is,
seems like a pretty standard process, just haven't put the pieces
together yet.  ugh
(this is in a user control, ascx, by the way)

thanks for any help and an example would be great!

Author
5 Feb 2006 6:45 AM
Cor Ligthert [MVP]
Simon,

It is easier to use Image Buttons for this kind of things.

You only have to know it.

I hope this helps,

Cor
Author
5 Feb 2006 3:41 PM
simon
thanks, i think i tried that, not sure been trying so many new things
lately.  but one of the issues with using something like that was that
i was not sure how to give the onMouse commands within the tag.  lots
of squigglies come up if i'm not mistaken, which makes me a little
nervous to see them in the code

Show quoteHide quote
>Simon,
>
>It is easier to use Image Buttons for this kind of things.
>
>You only have to know it.
>
>I hope this helps,
>
>Cor
>
Author
5 Feb 2006 6:32 PM
Ken Tucker [MVP]
Hi,

         Not sure if this the best method but you can use ajax to call a
function in the code behind with javascript.

http://www.vb-tips.com/default.aspx?ID=12499601-19c8-43bf-94bd-73214b27750c

Ken
--------------------------------

Show quoteHide quote
"simon" wrote:

> thanks, i think i tried that, not sure been trying so many new things
> lately.  but one of the issues with using something like that was that
> i was not sure how to give the onMouse commands within the tag.  lots
> of squigglies come up if i'm not mistaken, which makes me a little
> nervous to see them in the code
>
> >Simon,
> >
> >It is easier to use Image Buttons for this kind of things.
> >
> >You only have to know it.
> >
> >I hope this helps,
> >
> >Cor
> >
>
>
Author
5 Feb 2006 7:15 PM
Cor Ligthert [MVP]
Simon,

You can add to every control attributes using VBNet.

http://msdn2.microsoft.com/en-us/library/system.web.ui.attributecollection.addattributes.aspx

I hope this helps,

Cor

Show quoteHide quote
"simon" <m*@here.com> schreef in bericht
news:l27cu1tpgno83mjtohrqqb3o67a00q3s73@4ax.com...
> thanks, i think i tried that, not sure been trying so many new things
> lately.  but one of the issues with using something like that was that
> i was not sure how to give the onMouse commands within the tag.  lots
> of squigglies come up if i'm not mistaken, which makes me a little
> nervous to see them in the code
>
>>Simon,
>>
>>It is easier to use Image Buttons for this kind of things.
>>
>>You only have to know it.
>>
>>I hope this helps,
>>
>>Cor
>>
>