Click here to Skip to main content
15,887,683 members
Home / Discussions / Web Development
   

Web Development

 
SuggestionRe: THE IMAGE IS NOT DISPLAY CROOS MARK APPEARS ON WEBPAGE Pin
Richard MacCutchan3-Nov-14 21:29
mveRichard MacCutchan3-Nov-14 21:29 
AnswerRe: THE IMAGE IS NOT DISPLAY CROOS MARK APPEARS ON WEBPAGE Pin
ZurdoDev4-Nov-14 8:21
professionalZurdoDev4-Nov-14 8:21 
QuestionCSS Problem Pin
Kevin Marois3-Nov-14 10:41
professionalKevin Marois3-Nov-14 10:41 
AnswerRe: CSS Problem Pin
Richard Deeming3-Nov-14 11:30
mveRichard Deeming3-Nov-14 11:30 
GeneralRe: CSS Problem Pin
Kevin Marois3-Nov-14 11:49
professionalKevin Marois3-Nov-14 11:49 
AnswerRe: CSS Problem Pin
Kornfeld Eliyahu Peter3-Nov-14 21:10
professionalKornfeld Eliyahu Peter3-Nov-14 21:10 
GeneralRe: CSS Problem Pin
Richard Deeming3-Nov-14 23:19
mveRichard Deeming3-Nov-14 23:19 
QuestionASP.Net MVC 5 - First Project Error Pin
Kevin Marois3-Nov-14 5:51
professionalKevin Marois3-Nov-14 5:51 
AnswerRe: ASP.Net MVC 5 - First Project Error Pin
Kevin Marois3-Nov-14 6:02
professionalKevin Marois3-Nov-14 6:02 
GeneralHandlings rows in Datatables Pin
adekunbi29-Oct-14 3:43
adekunbi29-Oct-14 3:43 
SuggestionRe: Handlings rows in Datatables Pin
ZurdoDev29-Oct-14 5:46
professionalZurdoDev29-Oct-14 5:46 
GeneralRe: Handlings rows in Datatables Pin
adekunbi29-Oct-14 6:01
adekunbi29-Oct-14 6:01 
GeneralRe: Handlings rows in Datatables Pin
ZurdoDev29-Oct-14 6:04
professionalZurdoDev29-Oct-14 6:04 
GeneralRe: Handlings rows in Datatables Pin
adekunbi29-Oct-14 23:40
adekunbi29-Oct-14 23:40 
QuestionRe: Handlings rows in Datatables Pin
ZurdoDev30-Oct-14 1:37
professionalZurdoDev30-Oct-14 1:37 
AnswerRe: Handlings rows in Datatables Pin
adekunbi30-Oct-14 1:41
adekunbi30-Oct-14 1:41 
GeneralRe: Handlings rows in Datatables Pin
ZurdoDev30-Oct-14 1:52
professionalZurdoDev30-Oct-14 1:52 
GeneralRe: Handlings rows in Datatables Pin
adekunbi30-Oct-14 2:02
adekunbi30-Oct-14 2:02 
AnswerRe: Handlings rows in Datatables Pin
ZurdoDev30-Oct-14 2:12
professionalZurdoDev30-Oct-14 2:12 
GeneralRe: Handlings rows in Datatables Pin
adekunbi29-Oct-14 23:57
adekunbi29-Oct-14 23:57 
QuestionTypeError: $(...).autocomplete is not a function Pin
NarVish24-Oct-14 0:20
NarVish24-Oct-14 0:20 
I'm trying to implement autocomplete feature for my search text box. Fire bug shows the error shown in subject. Please let me know my mistake.
Please find my code below.

HTML
@model MvcApplication1.Models.UserProfile

@{
    ViewBag.Title = "UserProfile";
}
 
<form method="post"> 
    <input type="text" name="userName" />
    <input type="submit" value="Search By Name" />
</form>

<div id="restaurantList">
    @foreach (var item in ViewBag.users)
    {
        <div>
            <h4>@item.UserName</h4>
            <div>
                @item.Country
            </div>
            <div>
                Mail: @item.Email
            </div>
            <hr />
        </div>
    }
</div>

 <script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script src="~/Scripts/jquery-ui-1.9.2.min.js"></script> 
@Styles.Render("~/Content/themes/base/css")

<script type="text/javascript">
    $(document).ready(function () {
        
        $("#userName").autocomplete({
            source: function (request, response) {
                 
                $.ajax({
                    url: "~/Home/AutoCompleteName",
                    type: "POST",
                    dataType: "json",
                    data: { term: request.term },
                    success: function (data) {
                        response($.map(data, function (item) {
                            return { label: item.Country, value: item.Country };
                        }))
                    }
                })
            },
            messages: {
                noResults: "", results: ""
            }
        });
    })
</script>



Code in Controller:

C#
 public ActionResult UserProfile(string userName = null)
{
            string conString = "User Id=RDB; password=RDB; Data Source=172.18.164.146:1521/XE; Pooling=false;";

            OracleConnection con = new OracleConnection();
            con.ConnectionString = conString;
            con.Open();

            OracleCommand cmd = con.CreateCommand();
            cmd.CommandText = "select USR_USERNAME, USR_COUNTRY, USR_EMAIL_ADDR from OBRS_USER";

            OracleDataReader reader = cmd.ExecuteReader();
            _db.UserProfiles = new List<Models.UserProfile>();
            UserProfile user;
            while (reader.Read())
            {
                user = new UserProfile();
                user.UserName = reader.GetString(0);
                user.Country = reader.GetString(1);
                user.Email = reader.GetString(2); 
                _db.UserProfiles.Add(user);
            } 
            var model =
                _db.UserProfiles
                   .OrderByDescending(r => r.UserName)
                   .Where(r => userName == null || r.UserName.StartsWith(userName));
                            ViewBag.users = model;
            return View();
        }

        public JsonResult AutoCompleteName(string term)
        {
            var result = (from r in _db.UserProfiles
                          where r.UserName.ToLower().Contains(term.ToLower())
                          select new { r.UserName }).Distinct();
            return Json(result, JsonRequestBehavior.AllowGet);
        }

SuggestionRe: TypeError: $(...).autocomplete is not a function Pin
Laiju k24-Oct-14 0:39
professionalLaiju k24-Oct-14 0:39 
GeneralRe: TypeError: $(...).autocomplete is not a function Pin
NarVish24-Oct-14 0:46
NarVish24-Oct-14 0:46 
AnswerRe: TypeError: $(...).autocomplete is not a function Pin
Laiju k24-Oct-14 1:18
professionalLaiju k24-Oct-14 1:18 
GeneralRe: TypeError: $(...).autocomplete is not a function Pin
NarVish24-Oct-14 2:01
NarVish24-Oct-14 2:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.