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

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.
 
S

Steve C. Orr, MCSD

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.
 
E

exshige

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.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top