i am write one javascript function
as below
i want to pass the a value to the my code behind .how i pass it
function myKeyPress(e) {
var keynum;
if (window.event) { // IE
keynum = e.keyCode;
} else
if (e.keyCode==13) { // Netscape/Firefox/Opera
keynum = e.which;
alert(String.fromCharCode(keynum));
}
else if (e.keyCode == 65) {
return false;
}
var a = String.fromCharCode(keynum);
}


ramya bharathRank #3,780 · 391 reputationPosted Apr 12, 2015, 6:50 AM EDT
Manoj BhoirRank #599 · 4K reputationPosted Apr 12, 2015, 8:21 AM EDT
You can do it using Ajax: http://en.wikipedia.org/wiki/Ajax_%28programming%29
One convenient way of using Ajax is using jQuery .Ajax(): http://api.jquery.com/jquery.ajax/
Or you can do so using Hidden Field.
Create a hidden field variable in the client side as
In the javascript you can assign some value to the hidden variable as
and you can read the hidden field variable in the code behind as
string variable = hdnfldVariable.Value;
I hope this will help you.
Gowtham RajamanickamRank #57 · 29K reputationPosted Apr 12, 2015, 8:28 AM EDT
Abhijit PatilRank #700 · 3.4K reputationPosted Apr 13, 2015, 9:46 PM EDT