Boa noite!
Pessoal, estou fazendo algo errado? o código compila tudo certinho. porém não funciona no browser.
Segue código na View():
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Fretes.Models.ConhecimentoTransporte>>" %><asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> ConhecimentoTransporteList</asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"><h2>ConhecimentoTransporteList</h2><script language="javascript" type="text/javascript"> $(function () { $("#txtSearch").autocomplete({ source: "../../ConhecimentoTranporte/AutocompleteSuggestions", minLength: 1, select: function (event, ui) { if (ui.item) { $("#txtSearch").val(ui.item.value); $("form").submit(); } } }); });</script><p><%: Html.ActionLink("Criar Novo", "Create") %></p><% using (Html.BeginForm()) { %><b> Transportadora/Cliente/Fornecedor </b><%: Html.TextBox("search", null, new { id = "txtSearch" })%><input type = "submit" value ="Search" /><% } %><table><tr><th></th><th> DataEmissao</th><th> Redespacho</th><th> Origem</th><th> Destino</th><th> Transportadora</th><th> ValorFrete</th><th> Vencimento</th><th> Data Saida</th><th> Data Entrega</th></tr><% foreach (var item in Model) { %><tr><td><%: Html.ActionLink("Edit", "Edit", new { id=item.Id }) %> |<%: Html.ActionLink("Details", "Details", new { id=item.Id })%> |<%: Html.ActionLink("Delete", "Delete", new { id=item.Id })%></td><td><%: String.Format("{0:g}", item.DataEmissao) %></td><td><%: item.Redespacho %></td><td><%: item.OrigemDestino.Nome %></td><td><%: item.OrigemDestino1.Nome %></td><td><%: item.CliFor.RazaoSocial %></td><td><%: String.Format("{0:F}", item.ValorFrete) %></td><td><%: String.Format("{0:g}", item.Vencimento) %></td><td><%: String.Format("{0:g}", item.DataSaida) %></td><td><%: String.Format("{0:g}", item.DataEntrega) %></td></tr><% } %></table></asp:Content>
E o código no controller:
public JsonResult AutocompleteSuggestions(string term) { var suggestions = from s in banco.CliFor select s.RazaoSocial; var cflist = suggestions.Where(x => x.ToLower().StartsWith(term.ToLower())); return Json(cflist, JsonRequestBehavior.AllowGet); }
Por favor, me ajudem, eu agradeço muito.