Greetings,
I have an View Index that passes the values of the "id" column to another View Index , as code below:
<a data-bind="attr: {href: url()}" target="_blank" href="@Url.Action("Index","Vw_RegistroVisita", new { id = item.id })">
<i class="fas fa-street-view" title="Visitas"></i>
</a>
The code below is the View 2 that receives the value of the "id" column and does the search:
@using (Html.BeginForm())
<p>
<div class="row">
<div class="col-lg-3">
@Html.TextBox("id", null, new { @class = "form-control", @placeholder = "Digite o nome", style = "width: 260px" })
</div>
<div class="col-lg-1">
<button class="btn btn-outline-primary" type="submit"><i class="fas fa-search"></i></button>
</div>
</div>
</p>
And this is Controller 2 of View that receives the values and does the search:
// GET: Vw_RegistroVisita
public ActionResult Index(Vw_RegistroVisita registroVisita, int id)
{
var estrangeiro = db.Vw_RegistroVisita.Find(id);
ViewBag.id = new SelectList(db.Vw_RegistroVisita, "id", "nome", registroVisita.id);
return View(db.Vw_RegistroVisita.ToList());
}
So far so good. The value that I select in the View Index # 1 appears in the TextBox in View Index
Now my help request: How do I use this value, that the Index # 1 has passed to Index # 2, and do a search and return the data in Index # 2?