Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi I want move focus from text box to below anchor when I click tab...
How can I acheve this

<asp:TextBox ID="txtbox1" Columns="30" runat="server" CssClass="input" MaxLength="50">



XML
<div class="btnLigtBlue floatR" id="divadd">
                                            <a id="alinkAdd" class="addIcon1" runat="server" onclick="Show();SetSystemNavigation();">
                                                Add </a>
                                        </div>
Posted
Updated 18-Jun-13 19:09pm
v2

Hi,

You do not need to write the any kind of JavaScript funcation for that.

You can use the "TabIndex" property of the control.
You can set the sequence for the controls using this TanIndex property.

Please refer the below sample code for the same, it may help you:

XML
<asp:TextBox runat="server" ID="TxtName" TabIndex="0" ></asp:TextBox>
    <br />
    <br />

    <a id="anchor"  tabindex="1" href="http://www.codeproject.com/">Test Anchor Tag</a>
    <br />
    <br />

    <asp:Button runat="server" TabIndex="2" ID="BtnSubmit" Text="Submit"/>


Thanks ..

From,
Dhiraj Luhana
 
Share this answer
 
Comments
syna syna 19-Jun-13 1:14am    
But in some scenarios extra controls will come between textbox and anchor tag then focus has to move to that controls
dhirajluhana 19-Jun-13 1:51am    
are u render the controls on the page at runtime ?? using the code behind file ?
syna syna 19-Jun-13 4:12am    
yes
 
Share this answer
 
v3
Comments
dhirajluhana 19-Jun-13 1:50am    
Hi Rohan,
----------------------------------
vasantha.M - 29 mins ago
But in some scenarios extra controls will come between textbox and anchor tag then focus has to move to that controls
-----------------------------------------

what should be do in this senariao
Thanks7872 19-Jun-13 1:52am    
I provided all the materials regarding TAB. You have to code it appropriately to apply the same. It depends on you how you want your tabindex to be worked.and i mentioned in last line also.

After these links,you would have idea how tab works,and how to handle it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900