Solved

User Controls with AutoCompleteExtender

Posted on 2011-02-25
9
677 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
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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Syntax Error 2 47
how to read json value 2 32
When should I use a controller? 3 26
jquery progress bar 3 21
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 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

26 Experts available now in Live!

Get 1:1 Help Now