Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi all,

I have an image control in my aspx page.
here right clicking on the image i want to increment variable value in code behind. that is in aspx.cs.
how can i achieve this functionality.


Thanx,
Venkatesh
Posted
Comments
Sergey Alexandrovich Kryukov 31-Dec-12 1:42am    
What did you try?
—SA

1 solution

You can register some JavaScript handling the click. As you need to handle the even on the server side (but are you sure? maybe handling it on the client side using JavaScript is better?), you would need to use Ajax to send an HTTP request to the server side. As you need a right, not left mouse click, you may want to use just the event onmouseup.

Please see:
http://www.w3schools.com/js/js_htmldom_events.asp[^],
http://www.w3schools.com/jsref/dom_obj_event.asp[^].

On Ajax:
http://www.w3schools.com/ajax/default.asp[^],
http://www.w3schools.com/ajax/ajax_intro.asp[^],
http://www.w3schools.com/ajax/ajax_examples.asp[^].

However, I would rather advise using jQuery for both purposes. Please see:
http://en.wikipedia.org/wiki/JQuery[^],
http://jquery.com/[^],
http://api.jquery.com/category/events/[^],
http://api.jquery.com/category/ajax/[^].

If you need to learn jQuery, start here:
http://docs.jquery.com/Tutorials[^],
http://docs.jquery.com/Tutorials:How_jQuery_Works[^].

Good luck,
—SA
 
Share this answer
 
Comments
ridoy 31-Dec-12 3:48am    
+5
Sergey Alexandrovich Kryukov 31-Dec-12 11:50am    
Thank you very much,
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900