I have several controls in my asp.net webform (textboxes, checkboxes, hypelinks and buttons). I set their tab indexes (from 1, 2 ...) but when I run the webform, the tabbing doesnt work. The focus goes to the URL and not the controls. Another weird thing
is that I have to click the button twice before its activated. Pls. help. Thanks.
System.Web.UI.WebControls.TextBox' does not contain a definition for 'Focus'
The tabbing order is now working, but I still couldnt force a textbox to get the focus during pageload(). Also, I have to click the button twice before it's event handler executes.
I hope someone can help with this case. I have a gridview whose datasource is an objectdatasource. When the user tabs across the gridview, the tab order goes vertically thru the cells from one column to the next instead of going horizontally across each
row. Please advise. Thanks.
Please mark this post as "Answer" and earn a point.
PROBLEM REASON: I think the IE GUI automatically has its own controls set with their tabindex=o
SOLUTION: Have all your tab indexes set higher than zero (0). E.g FirstItem tabindex=1, SecondItem tabindex=2, ...
Then on page load do this: FirstItem.focus()
EXPLANATION: Setting focus to start with a control item with tabindex number higher than the values of IE GUI controls ignors such stops at url bars etc.
i hv some text box and few image buttons, i hv set textboxname1.focus() at page load to first textbox control, also, hv my intex higher then 0 i.e. it starts from 1, while tabbing the tab index works fine till i m tabbing through all the textbox but it never
reaches imagebuttons on the form, instead goes to all the controls on masterpage (all tab of ths masterpage too set to 0).
can anyone help me to know why image button never gets focus....
evb5145
Member
51 Points
91 Posts
Tab Index not working
Feb 27, 2007 05:26 PM|LINK
Hello!
I have several controls in my asp.net webform (textboxes, checkboxes, hypelinks and buttons). I set their tab indexes (from 1, 2 ...) but when I run the webform, the tabbing doesnt work. The focus goes to the URL and not the controls. Another weird thing is that I have to click the button twice before its activated. Pls. help. Thanks.
cmorrisey
Member
147 Points
40 Posts
Re: Tab Index not working
Feb 27, 2007 06:05 PM|LINK
Elizabeth,
By design of the tabindexing, the first tab will be the address bar (cite: Microsoft)
However, you can set the default focus of the control you want to be tabindex 1. You can do this by calling Focus() on it.
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Focus();
}
When the page is loaded, the cursor will be blinking in the textbox to start off.
When you say the tabbing doesn't work - what is it doing?
Thanks,
Chelsea
focus textbox button tabindex
~*~*~*~*~*~
Thanks,
Chelsea
evb5145
Member
51 Points
91 Posts
Re: Tab Index not working
Feb 27, 2007 06:38 PM|LINK
I'm getting a build error:
System.Web.UI.WebControls.TextBox' does not contain a definition for 'Focus'
The tabbing order is now working, but I still couldnt force a textbox to get the focus during pageload(). Also, I have to click the button twice before it's event handler executes.
evb5145
Member
51 Points
91 Posts
Re: Tab Index not working
Feb 27, 2007 07:22 PM|LINK
thuhue
All-Star
15625 Points
3146 Posts
Re: Tab Index not working
Oct 17, 2007 12:50 AM|LINK
I hope someone can help with this case. I have a gridview whose datasource is an objectdatasource. When the user tabs across the gridview, the tab order goes vertically thru the cells from one column to the next instead of going horizontally across each row. Please advise. Thanks.
Rutgers
Member
20 Points
10 Posts
Re: Tab Index not working
Nov 27, 2007 02:32 PM|LINK
PROBLEM REASON: I think the IE GUI automatically has its own controls set with their tabindex=o
SOLUTION: Have all your tab indexes set higher than zero (0). E.g FirstItem tabindex=1, SecondItem tabindex=2, ...
EXPLANATION: Setting focus to start with a control item with tabindex number higher than the values of IE GUI controls ignors such stops at url bars etc.
I hope this helps.
~Ted Atogwe
http://www.survivenigeria.com
poddar_himan...
Member
319 Points
75 Posts
Re: Tab Index not working
Dec 07, 2007 12:14 PM|LINK
hi all,
i hv some text box and few image buttons, i hv set textboxname1.focus() at page load to first textbox control, also, hv my intex higher then 0 i.e. it starts from 1, while tabbing the tab index works fine till i m tabbing through all the textbox but it never reaches imagebuttons on the form, instead goes to all the controls on masterpage (all tab of ths masterpage too set to 0).
can anyone help me to know why image button never gets focus....
my tab seq is soemthing like this
txtBox1 tabindex1
txtBox2 tabindex2
txtBox3 tabindex3
imagebuton tabindex4...and so on.
Mark as answered if this or any other post helps in finding solution to ur query, it will help others later....
Rutgers
Member
20 Points
10 Posts
Re: Tab Index not working
Dec 07, 2007 12:36 PM|LINK
Is this web based?
Rutgers
Member
20 Points
10 Posts
Re: Tab Index not working
Dec 07, 2007 02:27 PM|LINK
I just tried it and it works. Below is the code:
'VB.NET SIDE
Partial Class TabTest Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End SubEnd
Class************** ASPX SIDE: NOTE your image name should be 1.jpg, or you replace 1.jpg with your image name
<%
@ Page Language="VB" AutoEventWireup="false" CodeFile="TabTest.aspx.vb" Inherits="TabTest" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><
html xmlns="http://www.w3.org/1999/xhtml" ><
head runat="server"> <title>Testing Tab Index</title></
head><
body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server" Style="z-index: 100; left: 22px; position: absolute; TabIndex="1"></asp:TextBox> <asp:TextBox ID="TextBox2" runat="server" Style="z-index: 101; left: 432px; position: absolute; top: 98px" TabIndex="3"></asp:TextBox> <asp:TextBox ID="TextBox3" runat="server" Style="z-index: 102; left: 228px; position: absolute; top: 98px" TabIndex="2"></asp:TextBox> <asp:ImageButton ID="ImageButton1" runat="server" Height="133px" ImageUrl="~/img/1.jpg" Style="z-index: 104; left: 253px; position: absolute; top: 263px" TabIndex="4" Width="228px" />
</div> </form></
body></
html>~ Itsede Ted Atogwe
http://www.survivenigeria.com/Founder.htm
poddar_himan...
Member
319 Points
75 Posts
Re: Tab Index not working
Dec 08, 2007 03:26 AM|LINK
hi and thanks,
u may see i too hv done the same thing as done above, the only difference is that i hv not provided style z index.
hope this must not be the reason for im proper functioning. also i hv done sme thing before and that too success full, here i dont know the problem..
Mark as answered if this or any other post helps in finding solution to ur query, it will help others later....