If you’re using the AutoCompleteExtender from the ASP.NET ajax toolkit, you’ll probably want to disable the autocomplete feature on textboxes as this tends to interfere with the autocomplete dropdown (the browser dropdown shows above the ajax dropdown).
To do this, you need to add the autocomplete attribute, like the following:
<input type=”text” autocomplete=”off” />
Ideally, the AutoCompleteExtender would automatically add this to the textbox to which it is bound (through the TargetControlID setting), but it doesn’t do this.
Unfortunately, the textbox control doesn’t offer a property for doing this, so to add this, you’ll need to use the following code on the page where your textbox control resides:
MyTextBox.Attributes.Add(“autocomplete”, “off”);
Alternatively, you could just subclass the textbox and add this property, if you need to use a textbox without autocomplete on many pages (eg. checkout screens where the credit card number shouldn’t autocomplete).
I’m using it for email completion only at present, and wrapped the AutoCompleteExtender and textbox into a user control, adding the code above into the OnInit method of the user control to disable autocomplete.
I’ve also added the following stylesheet into the user control, to change the textsize of the autocomplete dropdown, though it only seems to work in Firefox.
<style type=”text/css“>#<%=AutoComplete1.ClientID%>_completionListElem { font-family: arial; font-size: small;}</style>
Only the font-family and font-size settings work as the other settings are set using inline styles, though Microsoft should be changing this in a future release of the AutoCompleteExtender, giving us more control over how the menu is displayed.
I’ve been working on a large-ish project using ASP.NET, and decided it was time to add some ajax magic on some pages, which would improve functionality.
So, I downloaded ASP.NET ajax extensions 1.0, installed it, and added the reference to System.Web.Extensions in my project. Tried getting started with the update panel, which promptly threw up the error – Sys is undefined.
After some debugging, I found that calls to ScriptResource.axd were throwing a 404 page not found error, which was causing the ‘Sys is undefined’ error.. Fortunately, Chris Riccio has a great blog entry on demistifying sys is undefined. In my case, the problem was missing entries from web.config for the ajax extensions, handlers, etc. Adding these in solved that problem.
During this process, I also found that the ajax controls didn’t work with intellisense. As Vish says, there’s a number of solutions, including installing SP1, keeping the master page open, or changing the extension (prefix) used by the ajax controls.
I’m pretty sure I’ve got SP1 installed and it still doesn’t work, so for now I’ve gone for the last option, though this seems to have caused the generation of designer files to fail (ie. when a new control is added to an aspx page, the designer.cs is no longer updated automatically, throwing the error – generation of designer file failed: unknown server tag ‘aspajax:scriptmanager’).
Once all this was up and running, it was time to actually implement ajax in solving the problem at hand. On the user form, there is a radio button to select whether the user is an administrator or a regular user. Where the user is a regular user, a permissions panel should be displayed to select their permissions.
The radio button required some scrolling to get to, and when changed, triggered a postback to hide or show the permissions selector depending on whether yes or no was selected, resulting in the page scrolling back to the top. Whilst this could be solved using a page scroll position save or something similar, it seemed like a good excuse to get started with the asp.net ajax extensions too, hence the decision
Unfortunately, using the RadioButtonList is not so simple. On my page, the radiobuttonlist is initialised to ‘No’, which causes a postback to only occur when ‘Yes’ is clicked. If ‘Yes’ is clicked, the permissions panel is updated correctly, but if ‘No’ is then clicked, the panel is not updated.
After trying some workarounds without much success, I came across Steve Marx’ blog, where he also experienced this problem and named it The case of the RadioButtonList half-trigger. Although I’d tried wrapping the radio button list in a panel already (and got an ‘Invalid viewstate’ error), after reading his entry, I tried it again.
The resulting bug was a complete mystery. The OnClick handler seemed like it was being applied to both radio buttons and causing a postback. The page loaded with the default set to ‘No’. When ‘Yes’ was clicked, the permissions panel would update, but when ‘No’ was clicked again, the radio button would get selected, the ajax callback would take place, but then the ‘Yes’ button would get selected again and then panel would not update!
After spending a while trying to figure this out, I decided to start at the bottom and work my way up, going through the following steps to debug this:
- Grabbed Steve’s test page and created a basic page by itself. Worked.
- Copied this to my user page. Didn’t work.
- Took the user form out of the master page. Worked.
- Created a basic master page and used this with the user form. Worked.
- Removed user controls one-by-one from normal master page. Didn’t work.
- Compared normal master page to basic master page. The only difference was that the form in my master page was inside a table. Moved form tag in normal master page outside of table to just inside body tag. Probem solved!
Why this would cause the RadioButtonList to behave so strangely when inside an UpdatePanel with the ajax callback is a mystery, but fortunately, the solution turned out to be pretty simple.
I’m keen to run Vista, but don’t think my Lattitude D820 will be able to hack it. This machine runs slow with XP, though it’s probably due to all of the stuff loading at startup (but all much needed utilities - Norton AV, CLCL, Gaim, Snagit, Actual Window Manager, GAlert, Unlocker, Launchy, Slickrun, CFI ShellToysXP, etc).
Was considering getting a HP Media Center PC, though after hearing this call to HP’s technical support, I’d be quite reluctant to get anything from them.
The sad thing is that this type of tech support call is so common. Sounds just like my experience when calling Lingo. As Hamid Shoajee says, this is why companies shouldn’t be outsourcing tech support.
Yay! Google bought DoubleClick.
Search engine giant Google has agreed to buy web advertising network Doubleclick in a $3.1bn (£1.6bn) deal.
The cash buyout, the biggest in Google’s history, will allow the company to tighten its grip on the advertising market.
I’m really pleased about this. For years, we’ve been plagued with the crappy adverts DoubleClick inflicts on web users. Things worse than the appalling adverts on Hotmail. Hopefully this acquisition will change this trend…
If you’re thinking of moving to Lingo, think twice.
Signed up a few weeks ago, and cancelled shortly after due to trouble with their adapter and poor technical support. Before cancelling, I also cancelled the number transfer using their online control panel, and confirmed that my number would not be cancelled with the customer service representative who cancelled my account.
This morning, Lingo emailed me stating my number is going to be transferred in 4 days time, which is strange considering my account is cancelled. So, I replied to the automated email, and decided to follow up by calling them to ensure the number transfer is cancelled. Spoke to a completely useless dude from an Indian call centre who was no help whatsoever.
After 30 minutes, ended up having to hang up, take a deep breath, and call again hoping to speak to someone more capable. The cancellation department is staffed by Americans rather than Indians, so I decided to try and speak to them. Supposedly, they don’t deal with number transfers, and I was put through to another lady, who finally understood the problem, though couldn’t explain why it happened and couldn’t cancel it easily.
To add insult to injury, she said it would take a minimum of 3 days to try and halt the transfer, despite the date being set 4 days away.
Also, despite sending the Lingo adapter back to them via USPS with delivery confirmation, where the item was signed for, they claim they haven’t received it yet, and in what was an error on my part, I discarded the receipt once I’d checked that it had been received (and lost the package number). As a result, Lingo may issue another charge of $39.95 to my account for the lost adapter.
Then received an email from Lingo this afternoon, in reply to my message this morning, telling me that the number transfer had been cancelled, only to receive another 5 minutes later stating that the date had been set for 4 days away, just like the first email received.
I’m with Vonage at the moment, and although they have their problems, it was great calling their customer service department and speaking to an American who knew what I was talking about and put a note on the account requesting that the number should not be transferred to Lingo under any circumstances.
Talk about terrible customer service. If you’re thinking about using Lingo, be careful. Don’t transfer your number until you’re happy with the service, and if you have to deal with them by phone in any capacity other than to cancel your account – which seems to be staffed by Americans, expect lots of pain with incompetent Indian call centre staff.