|
-
Sep 30th, 2002, 05:51 PM
#1
Thread Starter
Junior Member
TextBox Navigation With Enter
In an .aspx I have:
I have 3 TextBoxes and 1 Button.
I want to navigate using Enter instead of Tab.
What do you think that is the reson, for why Microsoft didn't offer this alternative ?
Please ! Thanks
-
Oct 1st, 2002, 08:06 AM
#2
Frenzied Member
I think because enter is used to submit the page
-
Oct 1st, 2002, 08:28 AM
#3
Thread Starter
Junior Member
Please try to help me even you don't agree!
The problem is that I came from a background of programming in FilePro for Unix.
In that case when you hit Enter after you entered the data in a text box you jump in other textbox.
It is very difficult to convince people that are working in that environment 20 years to work with Tab instead of Enter. I think
that Enter is a more logical option that Tab.
How can I disable The Submit to be sent only onCkick and not on Enter
Thanks.
-
Oct 1st, 2002, 08:30 AM
#4
Frenzied Member
have you tried setting focus to the control using the ascii value?
-
Oct 1st, 2002, 08:44 AM
#5
Thread Starter
Junior Member
I don't know to do it in a web form.
Can you show me how or what I suppose to change to make it to work?
Please!
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Enter) Then
TextBox2.Select()
e.Handled = True
End If
End Sub
-
Oct 1st, 2002, 08:54 AM
#6
Frenzied Member
try to test for the ascii value 13...
If keyacsii = 13 then
txtbox1.setfocus
end if
-
Oct 1st, 2002, 09:09 AM
#7
Thread Starter
Junior Member
I tried but I am using VB.NET in aspx(ASP.NET) page not Visual Basic.
What suppose to be keyascii and TextBox it seams to don't have a setfocus() or even a select() method?
Dim keyascii As ?????
Any ideea ?
Thanks
-
Oct 1st, 2002, 10:05 AM
#8
Frenzied Member
I'll see if I can find you some code...
-
Oct 2nd, 2002, 05:23 PM
#9
Hyperactive Member
This is a good example of where people blame something that has nothing to do with the problem.
Asp.net is a worker process on a web server that takes the code in your .aspx page and returns html that conforms to the w3c specifications.
If you put an asp.net button on your page - <asp:button runat="server"> - this will appear in the source of your page once loaded as - <input type="submit" etc.
With any controls in asp.net they have to be converted to valid html before you see them in your webpage.
Once a form with controls like textboxes have loaded onto the page by conforming to the general behavious of html controls the TAB key is the key that moves from one control to the other. To overide this behaviour you will need to learn javascript. Javascript is a client-side code in that it one of the only scripts that manipulate the html that has loaded into the person browser. As asp.net is server side the only possible way with vb.net/c# code, and I'm not sure it would work, would be to submit the form every time a user presses enter and return the same page with the focus moved to the next control, which would be essentially pointless.
My suggestion would be to include validator controls that block anybody from submitting the form in error until all controls have been filled out correctly. That way if your user presses enter thinking they will move to the next control they wil get an error message and you could possibly set focus to the relevant control. The validator controls can automatically use javascript so as to avoid posting the form every time. This will teach people to use tab in no time at all. After all if they are using windows then they may have used enter in one application for 20 years but they have been using tab in a hell of a lot of other windows apps for quite some time too.
So basically learn javascript, write to the w3c and ask for new specifications to be introduced or drag your company's staff into the 21st century by using validator controls.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|