[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 694
  • Last Modified:

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
0
irmsystems
Asked:
irmsystems
  • 5
  • 4
1 Solution
 
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
 
irmsystemsAuthor Commented:
They are on seperate user controls, I changed the targetcontrolid on both and I still have the same issue.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 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
 
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

Featured Post

Technology Partners: 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!

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now