Click here to Skip to main content
11,565,672 members (43,256 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# MVC
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
Edited 7-Feb-13 6:39am
(no name)34.1K

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

  Print Answers RSS

Advertise | Privacy | Mobile
Web04 | 2.8.150624.2 | Last Updated 7 Feb 2013
Copyright © CodeProject, 1999-2015
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