6

I've got a problem with the AutoCompleteExtender inside the AJAX Control Toolkit which I just can't seem to get to the bottom of. The control sits inside an asp:Panel linked to a ModalPopupExtender from the toolkit. Everything works beautifully in the latest generations of IE9, FF and Opera but glitches in Safari and Chrome (assuming it's WebKit related).

The glitch is that the drop down from the autocomplete is falling behind the modal popup rather than in front of it (names blurred for privacy reasons):

enter image description here

Looking at things in Firebug, here's the drop down rendered in an unordered list:

<ul id="EmployeeAutoCompleteExtender_completionListElem" class="autoCompleteList" style="width: 281px; visibility: visible; position: absolute; left: 0px; top: 22px; z-index: 1000; ">

The autoCompleteList class looks like this:

.autoCompleteList
{
  list-style: none outside none;
  border: 1px solid buttonshadow;
  cursor: default;
  padding: 0px;
  margin: 0px;
}

And the resulting div for the modal popup looks like this:

<div id="MainContent_AddPeoplePanel" class="modalPopup" style="z-index: 100001; position: absolute; left: 719px; top: 352.5px; opacity: 1; ">

With the following modalPopup CSS class:

.modalPopup
{
  background-color: White;
  padding: 10px;
  width: 462px;
}

My assumption is that the lower z-index on the list is causing it to fall behind the div but then again, it plays nice in the non-WebKit browsers. The z-indexes are also inline styles so they're obviously coming straight from the controls. Am I missing something here? Any suggestions? (other than ditching WebForms and AJAX and employing jQuery)

Troy Hunt
  • 20,345
  • 13
  • 96
  • 151

3 Answers3

8

Seeing as you suspect it's the z-index causing the problem, what happens if you try and override the inline styles that are spat out by the Ajax Control Toolkit using !important?

.autoCompleteList {
  list-style: none outside none;
  border: 1px solid buttonshadow;
  cursor: default;
  padding: 0px;
  margin: 0px;
  z-index:2000 !important;
}

.modalPopup {
  background-color: White;
  padding: 10px;
  width: 462px;
  z-index:1000 !important;
}

I know it's a bit of a hack but if you haven't tried it yet it might be worth a shot?

Ian Oxley
  • 10,916
  • 6
  • 42
  • 49
  • Nice one! I ended up just dropping "z-index:100002 !important;" on the autoCompleteList class and it's jumped up on top of everything else. Hacky, but happy :) – Troy Hunt Aug 17 '11 at 10:15
  • Thank you! I had a feeling it was a z-index problem, but I was missing the !important. That fixed it. – Geoff Gunter Feb 11 '14 at 18:07
1

Ian, I was having a similar problem with a modal popup and several callout extenders. The callout was always under the popup. I lowered the z-index of the modal with the !important and poof. Started working. Thanks much for the suggestion.

0

I have came across same problem.

My code was running pretty fine in mozilla. but it was not working on Safari and Chrome.

Now I set "z-index:12000 !important;" to autocomplete class, because modal popup has 10051 z-index value.

Alex Kulinkovich
  • 4,408
  • 15
  • 46
  • 50