Solved

User Controls with AutoCompleteExtender

Posted on 2011-02-25
9
674 Views
Last Modified: 2012-06-21
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
0
Comment
Question by:irmsystems
  • 5
  • 4
9 Comments
 
LVL 9

Expert Comment

by:rawinnlnx9
Comment Utility
Yup both of your target control ID's are set to the same control "txtSearch" so both will fire for that control.
0
 
LVL 9

Expert Comment

by:rawinnlnx9
Comment Utility
Here is the visual:

 AutoCompleteExtender Code
0
 

Author Comment

by:irmsystems
Comment Utility
They are on seperate user controls, I changed the targetcontrolid on both and I still have the same issue.
0
 
LVL 9

Expert Comment

by:rawinnlnx9
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:irmsystems
Comment Utility
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
 
LVL 9

Expert Comment

by:rawinnlnx9
Comment Utility
Okay. I'd like to see it. I'll definitely follow up and help on this. It's intriguing.
0
 
LVL 9

Expert Comment

by:rawinnlnx9
Comment Utility
Once you post it send an email to winn{DOT}rex{AT}jacksonsfoodstores{DOT}com that way I can be more attentive.
0
 

Accepted Solution

by:
irmsystems earned 0 total points
Comment Utility
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
 

Author Closing Comment

by:irmsystems
Comment Utility
I was able to solve the issue on my own and that is why I'm marking my answer as the solution.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now