473,624 Members | 2,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to clear Ajax Combobox with Javascript?

2 New Member
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 4598
gits
5,390 Recognized Expert Moderator Expert
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
flyfisherguy
2 New Member
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._postBack Settings.async' is null or not an object" or something similar.

Hope this helps to explain the problem...
Apr 30 '10 #3
gits
5,390 Recognized Expert Moderator Expert
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
4307
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 from within an inline function. Within the AJAX object: this.xmlhttp = new XMLHttpRequest(); this.response = ''; //to contain the response text OR xml var that = this; //since we cannot reference this within the
0
1839
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
13559
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 document.form1.itemcross.length = 0; The only problem is that it leaves the optgroups. How do I also get rid of the optgroups? Thanks
3
18006
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 combobox. My problem is that when I try to clear the ComboBox it clears the items that were inserted into the ComboBox, but does not clear the item I selected in the ComboBox... For Instance.
1
16491
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 - microlink pattern tutorial : A microlink is a link that opens up
2
4255
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 functioning as desired when I test it on my machine using Visual Studio 2005. From what I have determined, the files I am forgetting are the JavaScript files from the Microsoft AJAX Library (See "To install Microsoft AJAX Library" at the bottom of...
0
7179
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 the way. First, deep linking is not something that a completely AJAX web site should be able to do by it's very nature of everything being on one page basically. So how can a person deep link to something that is on one page? This question...
10
3451
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 ------------- I have perl script which simply runs a ps on a Solaris server and generates a static html page with all of the code perfectly and this html page works fine when viewing it statically or with a META REFRESH header tag. The idea is to give the user...
2
2253
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 on .net and ajax seem to jump into atlas right away, does anyone know of any that teach ajax itself and then later get into atlas?
0
8688
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8352
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7178
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4085
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2614
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1800
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1496
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.