Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hello everyone,

today is my off day, so I wanted to spend some time on jquery ui. First I used the ready functions. Now I am trying this in a project that I'm already developing.

Simply, there is a textbox that is used to search.
My DDataController
C#
DDataBLL _data = new DDataBLL();
 public ActionResult Ara()
        {
            return View();
        }

        public ActionResult AraJSON(string term)
        {
            var data = _data.SelectAll().Where(x => x.Icerik.Contains(term));
            return Json(data, JsonRequestBehavior.AllowGet);
        }


And My view
Razor
@{
    ViewBag.Title = "Ara";
    Layout = "~/Views/Shared/_Layout.cshtml";
}@model IEnumerable<JQueryAutoComplete.Models.DData>
<h2>
    jQuery Ui Autocomplete</h2>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
<link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
<script type="text/javascript">
    $(function () {
        $("#deger").autocomplete({
            source: "/DData/AraJSON",
            minLength: 1,
        });
    });
</script>
<div class="demo">
    <div class="ui-widget">
        <label for="deger">
            Bir değer girin:
        </label>
        <input id="deger" size="50" />
    </div>
</div>


localproject/araJSON?term=a that request responses the exact data what the user request as JSON. No problem here. However, localproject/ara link does not fill the JSON data under the textbox. If data exists, a little box appear under the textbox with no text. What am I missing?
Posted

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

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900