focus question

Results 1 to 2 of 2

Thread: focus question

  1. #1
    Join Date
    Dec 1969

    Default focus question

    I have two text feilds and two command buttons on my page, when the user enters the page, fills the two text feild and hits enter the wrong command button is triggered. The two command buttons I have are an ok button to continue the process on the web site and the other button signs out the user. I guess what i need is a way so that that sign out button will not get the focus!! Any help will be greatly appretiated! Thank you for your time.

  2. #2
    Join Date
    Dec 1969

    Default RE: focus question

    If you are using ASP.Net 1.X:<BR>Use Client-script to overcome this problem(trap enter key code):<BR>&#060;body onkeydown="if(event.keyCode == 13){document.getElementById(&#039;btnSubmit&#039;) .click();}"&#062;<BR>...<BR>&#060;asp:Button id="btnSubmit" runat="server" text="Submit"&#062;&#060;/asp:Button&#062; <BR><BR>In case if you use ASP.Net 2.0, the solution is much simpler:<BR>Use the following attributes in the form tag.<BR>&#060;form id="Form1" defaultbutton="btnSubmit" runat="server"&#062;<BR>You can as well use "defaultfocus" attribute to set the focus to a specified control.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts