User Controls with AutoCompleteExtender

I have created 2 user controls with an autocompleteextender on them. I then dropped both user controls onto my page and both seem to work when you use only the keyboard to select an item.

When I use the mouse to select an item both the onclientitemselected methods get called.

I have used 2 autocompleteextenders before on one form but want to use the usercontrols I have.

<asp:AutoCompleteExtender ID="acStatus" BehaviorID="acStatus" runat="server" TargetControlID="txtSearch" EnableCaching="False" ServicePath="~/WebServices/Parameters/OrgStatus.asmx" ServiceMethod="GetQuickSearchList" OnClientItemSelected="AutoCompleteStatus" OnClientPopulated="StatusPopulated" DelimiterCharacters="" Enabled="True" FirstRowSelected="true" CompletionListElementID="quickwidth" CompletionInterval="150" MinimumPrefixLength="3" />


<asp:AutoCompleteExtender ID="acCountry" BehaviorID="acCountry" runat="server" TargetControlID="txtSearch" EnableCaching="False" ServicePath="~/WebServices/Parameters/Country.asmx" ServiceMethod="GetQuickSearchList" OnClientItemSelected="AutoCompleteCountry" OnClientPopulated="CountryPopulated" DelimiterCharacters="" Enabled="True" FirstRowSelected="true" CompletionListElementID="quickwidth" CompletionInterval="150" MinimumPrefixLength="3" />

I don't understand how the keyboard selection works but the mouse selection does something different. What could I be missing here?

Thank you
irmsystemsAsked:
Who is Participating?
 
irmsystemsAuthor Commented:
I found out what the issue is. In my markup I was using a div for the CompleteListElementID. I had it set on both controls to "quickwidth". Then in my markup I had

<div id="quickwidth"></div>

I guess when you used the mouse to select an item in the autocomplete list, it selected the div and since the id wasn't unique it would call the itemselected event for both autocompleteextenders. I changed the divs to be

<div id="quickcountrywidth" class="quickwidth"></div>
<div id="quickstatuswidth" class="quickwidth"></div>

And changed the CompleteListElementID on the extenders properties to match the proper div ids. The autocomplete now works with the keyboard and the mouse.
0
 
rawinnlnx9Commented:
Yup both of your target control ID's are set to the same control "txtSearch" so both will fire for that control.
0
 
rawinnlnx9Commented:
Here is the visual:

 AutoCompleteExtender Code
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
irmsystemsAuthor Commented:
They are on seperate user controls, I changed the targetcontrolid on both and I still have the same issue.
0
 
rawinnlnx9Commented:
Is the project large? Could someone download it and quickly run it to see the issues? If so zip it up and load it here. I'll download it and run it. I've faced similar problems in the past and I'm trying to remember how we fixed it.

In your page at the very top of the 'markup' you do have AutoEventWireup="true" right?
0
 
irmsystemsAuthor Commented:
Yes I have the autoeventwireup set to true. I will create a sample project and get my issue set up in there. The project I am working on is very large.
0
 
rawinnlnx9Commented:
Okay. I'd like to see it. I'll definitely follow up and help on this. It's intriguing.
0
 
rawinnlnx9Commented:
Once you post it send an email to winn{DOT}rex{AT}jacksonsfoodstores{DOT}com that way I can be more attentive.
0
 
irmsystemsAuthor Commented:
I was able to solve the issue on my own and that is why I'm marking my answer as the solution.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.