Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

JQuery autocomplete is not working in modalpopupextender inside a usercontrol

$
0
0

I have a usercontrol which has a modalpopupextender inside it and there is a text field with autocomplete functionality but somehow the below code is not working. 

<%@  Control Language="C#" AutoEventWireup="true" CodeFile="ucPostJob.ascx.cs" Inherits="ucPostJob" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><!-- auto email modal --><script language="javascript" type="text/javascript">$ $(document).ready(function () {
        var locations = ["Anywhere", "Gurgaon", "Delhi", "Noida", "Chennai", "Kolkata", "Ahmedabad", "Bengaluru", "Pune", "Hyderabad","Mumbai", "Chandigarh", "Dehradun", "Lucknow", "Mysore", "Faridabad", "Jaipur", "Coimbatore"];
        function split(val) {
            return val.split(/,\s*/);
        }
        function extractLast(term) {
            return split(term).pop();
        }$("#txtLocation")
        // don't navigate away from the field on tab when selecting an item
              .bind("keydown", function (event) {
                  if (event.keyCode === $.ui.keyCode.TAB &&$(this).autocomplete("instance").menu.active) {
                      event.preventDefault();
                  }
              })
              .autocomplete({
                  minLength: 0,
                  source: function (request, response) {
                      // delegate back to autocomplete, but extract the last term
                      response($.ui.autocomplete.filter(
                    locations, extractLast(request.term)));
                  },
                  focus: function () {
                      // prevent value inserted on focus
                      return false;
                  },
                  select: function (event, ui) {
                      var terms = split(this.value);
                      // remove the current input
                      terms.pop();
                      // add the selected item
                      terms.push(ui.item.value);
                      // add placeholder to get the comma-and-space at the end
                      terms.push("");
                      this.value = terms.join(", ");
                      return false;
                  }
              });
    });</script><div><asp:linkbutton id="lnkPostJob" cssclass="lnkPostJob" runat="server">Post Job</asp:linkbutton><asp:scriptmanager id="ScriptManager1" runat="server"></asp:scriptmanager><cc1:ModalPopupExtender ID="mdlJobPost" runat="server" PopupControlID="pnlJobPost"
        BehaviorID="bvJobPost" TargetControlID="lnkPostJob" BackgroundCssClass="modalBackground"
        CancelControlID="btnClose"></cc1:ModalPopupExtender><asp:panel id="pnlJobPost" runat="server" cssclass="modalPopup" align="center" style="display: none"><div style="background-color: White;"><div><div class="jobPostlbl">
                    Location</div><br /><asp:TextBox ID="txtLocation" runat="server" class="ucPostjobtxtJobTitle" MaxLength="200"
                    name="location" Style="position: relative;" /></div></div><div><asp:HyperLink ID="btnClose" runat="server" Text="Cancel" CssClass="btnClosePopup">Close</asp:HyperLink></div></asp:panel></div>


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>