Click here to Skip to main content
14,984,043 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
This is my controller.
public class HomeController : Controller
    {
        string commString = "";

        public HomeController()
        {
            FWUtility.connString = "Data Source = DEVELOPER1; Initial Catalog = FR8DemoDB; uid=sa; pwd=123;";
        }

        public ActionResult Index()
        {
            commString = "select BrandID, BrandName from BrandMaster order by BrandName";
            List<BrandMaster> listBrandMaster = FWUtility.GetList<BrandMaster>(FWUtility.GetDataTable(commString));
            var str = FWUtility.GetJson(listBrandMaster);
            return View(str);
        }
    }

    public class BrandMaster
    {
        public string BrandID { get; set; }
        public string BrandName { get; set; }
    }
}


This is my view.
@using System.Data;
@using JqeryUiAutoCompleteOnClickDisplayBrandIdOfBrandName.Controllers;
@model string
<script type="text/javascript">
    $(document).ready(function () {
            myFunction();
        });
function myFunction() {
            $.ajax({
            url: "../Home/Index",
            dataType: 'json',
            $("#tags").autocomplete({});
            });
        }
    </script>
<body>
    <div>
        <input id="tags">
    </div>
</body>


It is giving me error ,"Illegal characters in path". I want to display the "BrandName" through the Jquery autocomplete control. I have been trying this from yesterday. Plesae help.
Posted

1 solution

You are doing it wrong. Refer - Auto Complete TextBox Using jQuery and ASP.NET MVC[^] for step by step help.

Read and implement. You can also download the code and check.

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




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