Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
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 30-Dec-12 19:37pm
Comments
Sergey Alexandrovich Kryukov at 31-Dec-12 1:42am
   
What did you try?
—SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Comments
ridoy at 31-Dec-12 3:48am
   
+5
Sergey Alexandrovich Kryukov at 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)

  Print Answers RSS
0 OriginalGriff 390
1 Nirav Prabtani 273
2 _Amy 255
3 Richard Deeming 250
4 CHill60 195
0 _Amy 110
1 Maciej Los 90
2 OriginalGriff 85
3 Mehdi Gholam 80
4 Sergey Alexandrovich Kryukov 75


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 31 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100