Discussion in 'ASP .Net' started by Jarod_24, Apr 10, 2004.

  1. Jarod_24

    Jarod_24 Guest

    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)
    Jarod_24, Apr 10, 2004
    1. Advertisements

  2. Jarod_24

    jm Guest

    1.. Objects with a negative tabIndex are omitted from the tabbing order.
    also see:

    username textfield on a loginpage)

    "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 & _

    ' 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:

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


    It always has for me.

    whole grid/list and then each control?)

    see if that helps.

    pressend) or the cancel-button (when "Esc" is pressed)It looks like you are asking two different questions here. As to the first,

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

    Hope this helps.
    jm, Apr 10, 2004
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.