I am having difficulty popping the dropdown with sql server, because it comes repeated sql item ... ex: when I select the cities it comes with repeated cities and so on, and I can not direct to the search page. follow the code
Controller Home:
public class HomeController : Controller
{
public ActionResult Index()
{
EDGSiteEntities op = new EDGSiteEntities();
ViewBag.IdOperacao = new SelectList(op.Operacao, "IdOperacao", "Operacao1");
EDGSiteEntities cid = new EDGSiteEntities();
ViewBag.Cidade = new SelectList(cid.Cidade, "IdCidade", "Cidade1");
return View(ResultadoBusca);
}
[HttpPost]
public ActionResult Index(string IdOperacao,string Cidade)
{
string operacao = IdOperacao;
string operacaoRequest = Request["IdOperacao"];
string cidade = Cidade;
string cidadeRequest = Request["Cidade"];
return View(ResultadoBusca);
}
private ActionResult View(Func<ActionResult> ResultadoBusca)
{
throw new NotImplementedException();
}
public ActionResult Institucional()
{
return View();
}
public ActionResult FaleConosco()
{
return View();
}
public ActionResult Home()
{
return View();
}
public ActionResult Imoveis()
{
return View();
}
public ActionResult Venda()
{
return View();
}
public ActionResult Locação()
{
return View();
}
public ActionResult Consorcio()
{
return View();
}
public ActionResult ResultadoBusca()
{
return View();
}
public ActionResult ImovelDetalhe()
{
return View();
}
public ActionResult Serviços()
{
return View();
}
public ActionResult Servicos_Locatario()
{
return View();
}
public ActionResult Servicos_Locador()
{
return View();
}
page index
@{
ViewBag.Title = "Home Page";
Layout = "~/Views/Shared/_Layout.cshtml";
}
Quick Search:
@using (Html.BeginForm())
{
@Html.DropDownList("IdOperacao","Selecione")
@Html.DropDownList("Cidade", "Selecione")
<input Type="submit" value="Pesquisar" />
}
What I'm trying to do and a search for city and house type