TabIndex

  • Thread starter Thread starter Wayne Wengert
  • Start date Start date
W

Wayne Wengert

I cannot get the tab settings on an aspx page to work as desired. First of
all, I don't see a way to indicate whether a control is a tab stop. There is
a tabindex property for labels (why?). When I set a specific order for the
tabindex values that does not seem to be what happens on a page when the
user presses the tab key?

My books on asp.net don't even mention tabindex?

How do you control the focus order on an asp.net page?

Wayne
 
Hi Wayne,

Tabindex seems to be working okay in this sample. Just watch that you start
at 1 and don't use -1.

<form id="Form1" method="post" runat="server">
<p>
<asp:textbox id="TextBox1" tabIndex="1"
runat="server"></asp:textbox></p>
<p>
<asp:textbox id="TextBox2" tabIndex="2"
runat="server"></asp:textbox></p>
<p>
<asp:label id="Label1" tabIndex="4"
runat="server">Label</asp:label></p>
<p>
<asp:button id="Button1" tabIndex="3" runat="server"
Text="Button"></asp:button></p>
</form>

The label supports tabbing because when rendered, it comes out as a SPAN:

<P><SPAN id=Label1 tabIndex=4>Label</SPAN></P>

Does this help?

Ken
Microsoft MVP [ASP.NET]
Toronto
 
Ken;

Thanks for the response. I'll go back and try that again but since I don't
ever want the users to tab to a label it would be nice to have a "TabStop =
True/False" as we used to have.

Wayne

Ken Cox said:
Hi Wayne,

Tabindex seems to be working okay in this sample. Just watch that you start
at 1 and don't use -1.

<form id="Form1" method="post" runat="server">
<p>
<asp:textbox id="TextBox1" tabIndex="1"
runat="server"></asp:textbox></p>
<p>
<asp:textbox id="TextBox2" tabIndex="2"
runat="server"></asp:textbox></p>
<p>
<asp:label id="Label1" tabIndex="4"
runat="server">Label</asp:label></p>
<p>
<asp:button id="Button1" tabIndex="3" runat="server"
Text="Button"></asp:button></p>
</form>

The label supports tabbing because when rendered, it comes out as a SPAN:

<P><SPAN id=Label1 tabIndex=4>Label</SPAN></P>

Does this help?

Ken
Microsoft MVP [ASP.NET]
Toronto


Wayne Wengert said:
I cannot get the tab settings on an aspx page to work as desired. First of
all, I don't see a way to indicate whether a control is a tab stop. There
is
a tabindex property for labels (why?). When I set a specific order for the
tabindex values that does not seem to be what happens on a page when the
user presses the tab key?

My books on asp.net don't even mention tabindex?

How do you control the focus order on an asp.net page?

Wayne
 
Hey Wayne,

If you don't want the label to participate in the tabbing, set its tabindex
to -1.

Ken

Wayne Wengert said:
Ken;

Thanks for the response. I'll go back and try that again but since I don't
ever want the users to tab to a label it would be nice to have a "TabStop
=
True/False" as we used to have.

Wayne

Ken Cox said:
Hi Wayne,

Tabindex seems to be working okay in this sample. Just watch that you start
at 1 and don't use -1.

<form id="Form1" method="post" runat="server">
<p>
<asp:textbox id="TextBox1" tabIndex="1"
runat="server"></asp:textbox></p>
<p>
<asp:textbox id="TextBox2" tabIndex="2"
runat="server"></asp:textbox></p>
<p>
<asp:label id="Label1" tabIndex="4"
runat="server">Label</asp:label></p>
<p>
<asp:button id="Button1" tabIndex="3" runat="server"
Text="Button"></asp:button></p>
</form>

The label supports tabbing because when rendered, it comes out as a SPAN:

<P><SPAN id=Label1 tabIndex=4>Label</SPAN></P>

Does this help?

Ken
Microsoft MVP [ASP.NET]
Toronto


Wayne Wengert said:
I cannot get the tab settings on an aspx page to work as desired. First of
all, I don't see a way to indicate whether a control is a tab stop. There
is
a tabindex property for labels (why?). When I set a specific order for the
tabindex values that does not seem to be what happens on a page when
the
user presses the tab key?

My books on asp.net don't even mention tabindex?

How do you control the focus order on an asp.net page?

Wayne
 
Thanks - that helps

Wayne

Ken Cox said:
Hey Wayne,

If you don't want the label to participate in the tabbing, set its tabindex
to -1.

Ken

Wayne Wengert said:
Ken;

Thanks for the response. I'll go back and try that again but since I don't
ever want the users to tab to a label it would be nice to have a "TabStop
=
True/False" as we used to have.

Wayne

Ken Cox said:
Hi Wayne,

Tabindex seems to be working okay in this sample. Just watch that you start
at 1 and don't use -1.

<form id="Form1" method="post" runat="server">
<p>
<asp:textbox id="TextBox1" tabIndex="1"
runat="server"></asp:textbox></p>
<p>
<asp:textbox id="TextBox2" tabIndex="2"
runat="server"></asp:textbox></p>
<p>
<asp:label id="Label1" tabIndex="4"
runat="server">Label</asp:label></p>
<p>
<asp:button id="Button1" tabIndex="3" runat="server"
Text="Button"></asp:button></p>
</form>

The label supports tabbing because when rendered, it comes out as a SPAN:

<P><SPAN id=Label1 tabIndex=4>Label</SPAN></P>

Does this help?

Ken
Microsoft MVP [ASP.NET]
Toronto


I cannot get the tab settings on an aspx page to work as desired.
First
of
all, I don't see a way to indicate whether a control is a tab stop. There
is
a tabindex property for labels (why?). When I set a specific order
for
the
tabindex values that does not seem to be what happens on a page when
the
user presses the tab key?

My books on asp.net don't even mention tabindex?

How do you control the focus order on an asp.net page?

Wayne
 

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

Back
Top