Calling a function in codebehind from the html side of the aspx?

  • Thread starter Thread starter exshige
  • Start date Start date
E

exshige

I read from some book that you can actually on any tag in the html page put
a onClick or something and assign it with the sub/function name that is in
the codebehind. I tried but it say name undefined.

I am trying to make a rollover effect using codebehind. I have a <a> tag
that onmouseover will call a sub in codebehind to change a <asp:image> image
url.

How come i can see a lot of "on" events of the <a> in the html side but when
i declare it in the codebehind and i can only access only a few of them?

thanks.
 
It seems you misinterpreted the book that you read.

You don't want the page to post back every time the mouse moves over an
image. The performance would be terrible.

You want to call client side code such as javascript to do this, not your
code behind. And yes, you would use the (client side) onMouseOver event to
call your javascript function.
 
hmm.. thanks.. i actually did thought of using js to do that like the old
days.. but again, i thought maybe i could create something that is totally
vb based... i tried to put the code from codebehind together with the html
page under the script tag but it won't let me reference to other controls on
the page inside that sub or function.

i get what u mean.. well, i guess i have no choice but to use js.

thanks.
 
Back
Top