Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. ASCII value

ASCII value

Scheduled Pinned Locked Moved ASP.NET
csharpasp-net
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yogeshpan
    wrote on last edited by
    #1

    :rose::rose:hello to all...... I want to get ASCII value of enter key through ASP.Net and what namespace should be included for that. thanx in advacne...

    Raushan

    N 1 Reply Last reply
    0
    • Y yogeshpan

      :rose::rose:hello to all...... I want to get ASCII value of enter key through ASP.Net and what namespace should be included for that. thanx in advacne...

      Raushan

      N Offline
      N Offline
      newc1
      wrote on last edited by
      #2

      Hi Raushan, When a user hits a key on the keyboard, a client-side event is fired. The server is not used to capture or use this information as the server is simply recieving a request from the client (through the HTTP GET and POST protocols). Therefore you should focus on capturing and handling keyboard strokes on the client-side. The DOM's event object should provide you with the information you need when used in conjuction with the DOM onkeydown event (this is the event that is fired when a user hits a key). The following code shows an example of how to achieve this: Function to handle the key stroke: function checkKeyStroke(e) {   var characterCode;   if ( e && e.which ) {     e = e;     characterCode = e.which;   }   else {     e = event;     characterCode = e.keyCode;   }   if ( characterCode == 13 ) { // 13 is the ASCII character code for the enter key     // Add logic here to handle the key stroke  } } Attach it to the onkeydown event of the required element, in this case the body element: <body onkeydown="checkKeyStroke(event); ">

      Clean code is the key to happiness.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups