Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8495707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:38:50+00:00 2026-06-10T23:38:50+00:00

I have this TextBox txtCustomerName , it is associated with a Ajax AutoCompleteExtender ,

  • 0

I have this TextBox txtCustomerName, it is associated with a Ajax AutoCompleteExtender, what I am doing is at the OnClientItemSelected of this AutoCompleteExtender calling a function LoadCutomerDetails with jQuery. Something like this..

<asp:TextBox ID="txtCustomerName" runat="server" ClientIDMode="Static"></asp:TextBox>
<ajax:AutoCompleteExtender runat="server" ID="autoComplete1" TargetControlID="txtCustomerName"
ServicePath="~/AutoComplete.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="1" CompletionInterval="10" CompletionSetCount="15" OnClientItemSelected="PopulateData">

and Populate data is defined as

 function PopulateData() {
        var data2 = $('#txtCustomerName').val().split('-')[0];
        var newData = data2.substring(0, data2.length - 1);

        $.ajax({
            url: '/AutoComplete.asmx/GetPriorityAndRemarks',
            type: 'POST',
            timeout: 5000,
            datatype: 'xml',
            cache: false,
            data: 'arg=' + newData,
            success: function (response) {
                var doc = response;
                var result = $(doc).find("string").text();
                // the values is in form of name, address, mobile, priority and remark
                var resultAry = result.split(':');
                $('#lbCustomerName').val(resultAry[0]);
                $('#lblAddress').text(resultAry[1]);
            }
        });
    };

Now, what I wanna do is associate a event handler on focusout event of jQuery and check if lbCustomerName and lblAddress have any value, if not then this is a new customer, so open a popup dialog where details can be added, and so on..

The Problem is

  1. The focusout event fires before data could be filled lbCustomerName and lblAddress (by that Populate data), so it will always be null, even if there is data. (I checked the focus out event by showing a alert, and the alert was shown before the text of label(s) were updated.)

  2. The user can also type in the textbox and not just select a item from AutoCompleteExtender‘s list, right? So, in that case, the PopulalteData will not be called, but focusout will be.

What I would like to do is, call that focusout event only on condition when user types into the box (that is OnClientItemSelected is not fired), because if he is not selecting from the list, its a new customer obviosly.
So is there a way to do this? Or if not exactly this, then is some other way to accomplish what I am trying?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:38:52+00:00Added an answer on June 10, 2026 at 11:38 pm

    Couple thoughts:

    1) Can you really assume that if user isn’t selecting from list they aren’t in it? For example, if the user’s name is Tom and they just type it in quickly without using the autosuggest.

    2) Instead of using OnClientItemSelected can u call PopulateDate via the focusout event, and then pop up the dialog if the name/address are not in resultAry inside the ajax success callback?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code to prevent people entering '£' into a textbox jQuery(document).ready(function(){ jQuery('#cp_price').keypress(function(e){
In my web app I have a line which looks like this: small textbox
I have a textbox where a user puts a string like this: hello world!
I have a Form with TextBox on it like this: Form f = new
I have this written in a certain Javascript function. document.getElementById(textbox).innerHTML = some text; This
I have this function which evaluates the contents of a textbox (or combobox or
i have this code which add textbox dynamically row_no=0; function addRow(tbl,row){ row_no++; if (row_no<=20){
I have an HTML helper textBox like this: @Html.TextBox(txt1) <br /> Now I want
I have a text box like this <TextBox x:Name=SA1 Grid.Row=1 Grid.Column=1 TextAlignment=Center/> I need
i have an asp,net textbox like this <asp:TextBox readonly=true ID=txtLastService runat=server></asp:TextBox> when i tried

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.