1
I’m having difficulty in popular dropdown with sql server, because it comes repeated sql item ... ex: when I select cities it comes with repeated cities and so on, and I can’t direct to search page. follows 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();
}
index page
@{
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 looking to do and a search by city and type of home
What have you tried to do? Enter the code, it’s easier to help you.
– Taisbevalle
Post your code! if you can table structure and your code in the controller!
– novic
okay just a moment
– André Felipe Jardim Firmo
A question you are beginner in MVC Aspnet with Entity?
– novic
yes I’m a beginner in mvc but in aspx I know a little more
– André Felipe Jardim Firmo