473,385 Members | 2,014 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,385 software developers and data experts.

How to clear Ajax Combobox with Javascript?

Has anyone figured out how to clear an Ajax combobox or remove the attached datasource using Javascript? I have tried numerous methods, done massive searches but keep coming up empty. I'm also finding that after I load my combobox with server-side code that when I highlight the first item in the list and press enter to clear it a javascript error is thrown. Anyone else seeing this?
Apr 29 '10 #1
3 4590
gits
5,390 Expert Mod 4TB
what 'Ajax Combobox'? what error occurs? you would need to provide more information ... and probably some example code ... so that a reader might follow and could be able to identify the problem.

kind regards
Apr 30 '10 #2
Sorry if this is repeated, didn't see it from my first attempt:

Ok sorry, this is a pretty common problem that I have seen numerous users post on various websites, so I thought others would know without needing to give much detail...

Anyhow...

Here's the problem...

I have a web page that I'm trying to use an Ajax Control Toolkit Combobox control with for displaying a list of values. Here is some of the aspx code:

Expand|Select|Wrap|Line Numbers
  1. <cc1:ToolkitScriptManager ID="ToolkitScriptManager2" runat="server">
  2. </cc1:ToolkitScriptManager>
  3.  
  4. (other stuff...)
  5.  
  6.  
  7. <cc1:ComboBox ID="comboBox1" OnTextChangedcomboBox1_TextChanged" Width="100px" Style="vertical-align: middle;" AutoCompleteMode="Suggest" runat="server">
  8. </cc1:ComboBox>
  9.  
Here is the server side code to load the control:

Expand|Select|Wrap|Line Numbers
  1. var codes = new List<Items>(Factory.GetInstance<proxy>().LookupSel ectedCodes(comboBox1.Text.ToUpper()));
  2. comboBox1.Items.Clear();
  3. comboBox1.Items.Add(new ListItem(string.Empty, string.Empty));
  4. foreach (var code in Codes)
  5. {
  6. var listItem = new ListItem(code.Name, code.Name);
  7. comboBox1.Items.Add(listItem);
  8. }
  9. comboBox1.SelectedIndex = 0;
  10. comboBox1.DataBind();
  11. if (Codes.Count > 1)
  12. comboBox1.SelectedIndex = 1;

Hopefully when I post this it will format in a way that makes it readable.

The problem occurs when, after the combobox has been loaded, if the user highlights the first item in the list and hits either the Backspace key or the Delete key it throws a javascript error: 'this._postBackSettings.async' is null or not an object" or something similar.

Hope this helps to explain the problem...
Apr 30 '10 #3
gits
5,390 Expert Mod 4TB
that seems more like a ASP.NET question. i see that a JavaScript error occurs but obviously all this is encapsulated by the ASP.NET's Ajax Control Toolkit ... so i could move it for you to the ASP.NET forum ... think that you might get more responses there?

kind regards
May 1 '10 #4

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

Similar topics

4
by: bobzimuta | last post by:
I'm creating a simple AJAX library. It's an object that will return an array containing the response text or xml. I'm trying to find a way to assign the response as a property of the object, but...
0
by: melledge | last post by:
Ajax Developers' Day added to XTech 2006 agenda XTech 2006 - 17-19 May - Hotel Grand Krasnopolsky - Amsterdam, The Netherlands
16
by: Brian D | last post by:
I have a multiple select list that is created dynamically based on a previous selection on an asp page. The first thing I do is to clear the curent option list by ...
3
by: samoore33 | last post by:
I am populating a ComboBox at run time. I insert the first value of "Choose Value" cboTaxValue.Item.Insert(0, "Choose Value") Then I loop through the rest of the values to be added to the...
1
by: www.web20developers.com | last post by:
http://www.web20developers.com http://www.web20developers.com/index.php?option=com_content&task=view... Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell AJAX -...
2
by: Nathan Sokalski | last post by:
I am moving my website from my machine to my webhost, and need some help with what extra files I need to include due to the fact that I used AJAX in my site. Everything on the site is obviously...
0
by: Tarik Monem | last post by:
I have been working on an all AJAX/DOM web site which is set to go live today and I thought I'd share my discoveries with all of you whom have helped me when I have encountered different issues along...
10
by: paulie | last post by:
Hi, I have been experiencing an issue when trying to use AJAX to reload a DIV area using a timer of 2000ms, which contains a html page with another DIV and javascript. Scenario -------------...
2
by: soni2926 | last post by:
hi, does anyone know of any good books on ajax and asp.net, one that teaches ajax itself before jumping in atlas? I wanted to get an understanding of ajax and how to use it, most books i've seen...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.