473,378 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Dropwdown list in IE when using tab

112 100+
Hello there

I have a webform which has a dropdown list with the countries names in it. The dropdown list does a autopostback. When I try to fill the form using tab key to move from one controller to other, the dropdown list gives a problem.
In IE, if I have to select USA, when I tab down to the dropdown list and press U, the first country with U ie Uganda get selected automatically and focus jumps to next control. In firefox this works perfectly. can somebody help me with this..thank you...
Jan 25 '10 #1
4 1340
sanjib65
102 100+
First of all clear the AutoPostBack field of DropDownList and make the AutoPostBack of Page_Load() also not true. I hope it'll work fine. I made a simple application following the same rule and tab works fine giving no problem.

Expand|Select|Wrap|Line Numbers
  1. public class Country
  2. {
  3.     private string name;
  4.     public string Name
  5.     {
  6.         get { return name; }
  7.         set { name = value; }
  8.     }
  9.     public Country(string name)
  10.     {
  11.         Name = name;
  12.     }
  13.     public Country()
  14.     {
  15.         //
  16.         // TODO: Add constructor logic here
  17.         //
  18.     }
  19.     public static List<Country> GetCountry()
  20.     {
  21.         List<Country> country = new List<Country>();
  22.         country.Add(new Country("India"));
  23.         country.Add(new Country("USA"));
  24.         country.Add(new Country("England"));
  25.         country.Add(new Country("China"));
  26.         country.Add(new Country("bangladesh"));
  27.         country.Add(new Country("Pakistan"));
  28.         country.Add(new Country("France"));
  29.         return country;
  30.     }
  31. }
Expand|Select|Wrap|Line Numbers
  1. public partial class _Default : System.Web.UI.Page 
  2. {
  3.     private List<Country> country = Country.GetCountry();
  4.     protected void Page_Load(object sender, EventArgs e)
  5.     {
  6.         if (!IsPostBack)
  7.         {
  8.             DropDownList1.DataSource = country;
  9.             DropDownList1.DataTextField = "Name";
  10.             DropDownList1.DataValueField = "Name";
  11.             DropDownList1.DataTextFormatString = "Name: {0}";
  12.             DropDownList1.DataBind();
  13.         }
  14.  
  15.     }
  16.     protected void Button1_Click(object sender, EventArgs e)
  17.     {
  18.         Label1.Text = DropDownList1.SelectedValue;
  19.     }
  20. }
  21.  
In my page I dragged a DropDownList, a button and a Label. While tabbing, it comes first on DropDownList, second on Button, prssing enter it gives the selected country's name in Label.

Best of Luck.
Jan 26 '10 #2
user1980
112 100+
Thank you for the reply. But I would need to do a post back so that another dropdown populates depending on the selection of the country ddl. so in this case how would I achieve it.

thank you once again for your time.
Jan 26 '10 #3
Frinavale
9,735 Expert Mod 8TB
Have you considered handling the JavaScript onblur event for the DropDownList and manually doing a postback to the server?

-Frinny
Jan 26 '10 #4
sanjib65
102 100+
Besides trying what Frinavale has said, if I use .NET 3.5, then I'd try LinkDatSource as a common data access layer between these two controls.
Jan 27 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: fudmore | last post by:
Hello Everybody. I have a Segmentation fault problem. The code section at the bottom keeps throwing a Segmentation fault when it enters the IF block for the second time. const int...
6
by: massimo | last post by:
Hey, I wrote this program which should take the numbers entered and sort them out. It doesnąt matter what order, if decreasing or increasing. I guess I'm confused in the sorting part. Anyone...
7
by: Evangelista Sami | last post by:
Hi all i have implemented a list type as an array of pointer like this typedef struct { int nb_elements; void **elements; } list; to avoid having a pointer for each element as it is done...
4
by: JS | last post by:
I have a file called test.c. There I create a pointer to a pcb struct: struct pcb {   void *(*start_routine) (void *);   void *arg;   jmp_buf state;   int    stack; }; ...
8
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and...
44
by: Josh Mcfarlane | last post by:
Just out of curiosity: When would using std::list be more efficient / effective than using other containers such as vector, deque, etc? As far as I'm aware, list doesn't appear to be...
15
by: Macca | last post by:
Hi, My app needs to potentially store a large number of custom objects and be able to iterate through them quickly. I was wondering which data structure would be the most efficient to do this,a...
6
by: Amit Bhatia | last post by:
Hi, I am not sure if this belongs to this group. Anyway, my question is as follows: I have a list (STL list) whose elements are pairs of integers (STL pairs, say objects of class T). When I create...
7
by: =?Utf-8?B?Sm9lbCBNZXJr?= | last post by:
I have created a custom class with both value type members and reference type members. I then have another custom class which inherits from a generic list of my first class. This custom listneeds...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.