?
Solved

C# DetailsView set focus

Posted on 2012-04-13
1
Medium Priority
?
522 Views
Last Modified: 2012-05-08
I have a DetailsView that on its PreRender method, I set the Focus of the page to one of the textboxes inside the Details View.  It appears to work as a blinking cursor appears in the textbox I set the focus to.  However if I just press the enter key, the first Button on the page acts as if it has been clicked and executes its code.  I was just wondering how to stop the button from acting as if it was clicked and have the enter key do nothing when it is pressed
0
Comment
Question by:zintech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 22

Accepted Solution

by:
Mrunal earned 2000 total points
ID: 37858928
With the help of jQuery:

$("#TextBoxID").keypress(function() {
    var code = (e.keyCode ? e.keyCode : e.which);
    if(code == 13) { //Enter keycode
        return false;
    }
});


With javaScript:

http://www.rgagnon.com/jsdetails/js-0118.html

http://www.arraystudio.com/as-workshop/disable-form-submit-on-enter-keypress.html
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question