Reputation: 13
I Have A Grid view control in that grid view controls ItemTemplate i have taken textboxes now i want to do is that on pressing down arrow key the cursor which is in first textbox of first row will go to the first textbox of second row
This is the Grid view which i want to do the up down
Upvotes: 0
Views: 2721
Reputation: 3667
Use this URL, it's with code. Navigating through text input fields using arrow keys and return
<script type="text/javascript">
$(document).ready(function(){
// get only input tags with class data-entry
textboxes = $("input.data-entry");
// now we check to see which browser is being used
if ($.browser.mozilla) {
$(textboxes).keypress (checkForAction);
}
else {
$(textboxes).keydown (checkForAction);
}
});
function checkForAction (event) {
if (event.keyCode == 13 || 40) {
currentBoxNumber = textboxes.index(this);
if (textboxes[currentBoxNumber + 1] != null) {
nextBox = textboxes[currentBoxNumber + 1]
nextBox.focus();
nextBox.select();
event.preventDefault();
return false;
}
}
}
</script>
Upvotes: 1