Solved

User Controls with AutoCompleteExtender

Posted on 2011-02-25
9
686 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 9

Expert Comment

by:rawinnlnx9
ID: 34981756
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
ID: 34981772
Here is the visual:

 AutoCompleteExtender Code
0
 

Author Comment

by:irmsystems
ID: 34981828
They are on seperate user controls, I changed the targetcontrolid on both and I still have the same issue.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:rawinnlnx9
ID: 34981907
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
 

Author Comment

by:irmsystems
ID: 34981919
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
ID: 34981960
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
ID: 34981971
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
ID: 34998300
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
ID: 35045639
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ASP.NET Calendar Control 5 48
asp.net figure out error 3 41
.Net remove carriage returns, line feeds and tabbs 5 32
Difference between Leaflet and MapBox? 5 42
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 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