Click here to Skip to main content
15,896,269 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<td>
 <asp:DropDownList ID="ddlcountry" runat="server" AutoPostBack="true" TabIndex="1" OnSelectedIndexChanged="ddlcountry_SelectedIndexChanged">
  <asp:ListItem Text="--Select--" Value="0"></asp:ListItem>
  </asp:DropDownList>
  </td>

XML
<td><asp:DropDownList ID="ddlstate" Width="110px" TabIndex="2" runat="server"                                   AutoPostBack="true" OnSelectedIndexChanged="ddlstate_SelectedIndexChanged">
  <asp:ListItem Text="--Select--" Value="0"></asp:ListItem>
 </asp:DropDownList>

XML
<td>
 <asp:DropDownList ID="ddldistricts" runat="server" TabIndex="3">
  <asp:ListItem Value="0" Text="--Select--"></asp:ListItem>
 </asp:DropDownList>
 </td>


As i mentioned three dropdown lists,By selecting one dropdownlist another dropdownlist need to bind. so for that i kept autopostback property to true.Here I need to maintain tabindex after selecting 1st dropdown list cursor need to move the next dropdown list.How can i get Please help me.
Posted
Comments
Sinisa Hajnal 18-Nov-14 2:11am    
You mean when you select in the first, your focus needs to go down? Or that you loose tabindex numbers? The solution assumes the former since that is your description.
santhu888 18-Nov-14 2:16am    
What actually i want is,after selecting 1st dropdown list next when i click tab button then cursor needs to go next dropdown list
santhu888 24-Nov-14 12:15pm    
function fun() {

var txt = document.getElementById("txtid");
if (txt.value == "") {
alert("please enter user Id");
return false;
}
if (txt.value.length <= 12 && txt.value.length >= 5) {

}
else {
alert("must enter min 5 and 12 charachters");
return false;
}

var txtpwd = document.getElementById("txtpwd");
if (txtpwd.value == "") {
alert("please enter password");
return false;
}

if (txtpwd.value.length <= 12 && txtpwd.value.length >= 7) {

}
else {
alert("must enter min 7 and 12 charachters");
return false;
}
var name = document.getElementById("txtname");
if (name.value == "") {
alert("please enter name");
return false;
}
var address = document.getElementById("txtaddress");
if (address.value == "") {
alert("please enter address");
return false;


}
var ddlItemtype = document.getElementById("ddlcountry");
var ddlitem = ddlItemtype.options[ddlItemtype.selectedIndex].value;
if (ddlitem == 0) {
alert("Please Select Country.");
return false;

}
function IsValidEmail(email) {
var expr = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
return expr.test(email);
};
function ValidateEmail() {
var email = document.getElementById("txtemail").value;
if (!IsValidEmail(email)) {
alert("Invalid email address.");
}
else {
alert("Valid email address.");
}
}
function lettersOnly(e) {
var k;
document.all ? k = e.keyCode : k = e.which;
return ((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8);
}
function numberOnlyExample() {
if ((event.keyCode < 48) || (event.keyCode > 57))
return false;
}
}
http://www.c-sharpcorner.com/UploadFile/9f0ae2/gridview-edit-delete-and-update-in-Asp-Net/

1 solution

You simply need to set focus to the combobox needed in your SelectedIndexChanged handler.

C#
ddlstate.Focus();


And in the ddlstate handler you set
C#
ddldistricts.Focus();



If this helps please take time to accept the solution. Thank you.
 
Share this answer
 
Comments
santhu888 18-Nov-14 2:32am    
Yah its working fine But,Only in IE it is working,chrome and firefox it is not working.Please help me in that way
Sinisa Hajnal 18-Nov-14 3:52am    
It should...you could try ScriptManager.RegisterClientScript (google it) and set focus with client-side function (javascript has focus() method too)

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