TabIndex

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
 
K

Ken Cox [Microsoft MVP]

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
 
W

Wayne Wengert

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
 
K

Ken Cox [Microsoft MVP]

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
 
W

Wayne Wengert

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top