TabIndex

J

Jarod_24

How does tabindex work in ASP .net pages
I dosen't seem to work quite like in regular forms. and there isn't any TabStop property either.

1 .How do you prevent a control form beign "tabbed". (hidden textboxes ect.)

2. How do get a control to get focus when the page is loaded (think username textfield on a loginpage)

3. Does the tab-order work just like in regular forms (1 ->2 -> 3 and so on?)

4. How does tabindex work with datagrid and datalists. (does it focus the whole grid/list and then each control?)

5. How do you set a buttons to work as the default button (when "Enter" is pressend) or the cancel-button (when "Esc" is pressed)
 
J

jm

Jarod_24 said:
How does tabindex work in ASP .net pages
I dosen't seem to work quite like in regular forms. and there isn't any TabStop property either.

1 .How do you prevent a control form beign "tabbed". (hidden textboxes
ect.)
http://msdn.microsoft.com/library/d...uthor/dhtml/reference/properties/tabindex.asp
1.. Objects with a negative tabIndex are omitted from the tabbing order.
also see:

http://msdn.microsoft.com/library/d...ystemwindowsformscontrolclasstabstoptopic.asp


2. How do get a control to get focus when the page is loaded (think
username textfield on a loginpage)

http://www.ondotnet.com/pub/a/dotnet/2003/09/15/aspnet.html

"Private Sub SetFocus(ByVal ctrl As Control)
' Define the JavaScript function for the specified control.
Dim focusScript As String = "<script language='javascript'>" & _
"document.getElementById('" + ctrl.ClientID & _
"').focus();</script>"

' Add the JavaScript code to the page.
Page.RegisterStartupScript("FocusScript", focusScript)
End Sub

You can now call the custom SetFocus() function from any event handler to
change the control focus as needed:


SetFocus(myTextBox);
Remember, the focus change won't take effect until the page is rendered and
sent back to the browser."

3. Does the tab-order work just like in regular forms (1 ->2 -> 3 and so
on?)

It always has for me.

4. How does tabindex work with datagrid and datalists. (does it focus the
whole grid/list and then each control?)


http://msdn.microsoft.com/library/d...ystemwindowsformscontrolclasstabstoptopic.asp

see if that helps.

5. How do you set a buttons to work as the default button (when "Enter" is
pressend) or the cancel-button (when "Esc" is pressed)It looks like you are asking two different questions here. As to the first,

http://www.allasp.net/enterkey.aspx

http://216.239.41.104/search?q=cach...870+asp.net+set+default+button&hl=en&ie=UTF-8

http://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=asp.net+set+default+button

on your second, it looks like you want client side code, I would look at
onkeypress calling Javascript and using keycode:

http://www.google.com/search?num=100&hl=en&lr=&ie=UTF-8&oe=UTF-8&q=javascript+keycode

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top