Click here to Skip to main content
12,998,423 members (116,594 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi everyone, using javasript I managed to do an auto completion textbox. It worked in the testing app, but when I used it for the existing application, the controller method is always getting a null value. I guess the javascript function is returning a Null value. Does anyone have an idea on this? Thanks in advance!!!

code :

//in the  Homecontroller
        public JsonResult AutocompleteSuggestions(string serchtext)
            var suggestions = selectEmployees.getEmployeeSuggestedNumbers(serchtext);
            return Json(suggestions, JsonRequestBehavior.AllowGet);
//searchtext getting Null values from the View
<script src="<%: Url.Content("~/Scripts/jquery-1.4.4.min.js")%>" type="text/javascript"></script>
    <script src="<%: Url.Content("~/Scripts/jquery-ui.min.js")%>" type="text/javascript"></script>

      //in the index.aspx

<h3 class="searchlabel">Search</h3>
<form1  runat="server" action = "" method="post">
 <input id="searchTerm" name="searchTerm" type="text" />&nbsp;
     <script type="text/javascript">
         $(function () {
                 source: "/Home/AutocompleteSuggestions",
                 minLength: 1,
                 select: function (event, ol) {
                     if (ol.item) {
   <%-- <% Html.RenderPartial("~/Views/Home/Search.ascx"); %>   --%>
Posted 7-Feb-13 4:15am
Updated 7-Feb-13 6:39am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170622.1 | Last Updated 7 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100