Hello! I'm trying to get a filter parameter in my view with the following code in Controller
:
public ActionResult Cadastro(int? idParente)
{
var tab_Documentos_Parente = db.Tab_Documentos_Parente.Where(campo => campo.Id_Parente == idParente).Include(t => t.Tab_Documentos_Cadastrais_Par).Include(t => t.Tab_Parente);
return View(tab_Documentos_Parente.ToList());
}
But when I inform the url: link
It simply does not run the filter. Making a Debug
in Controller
I see that my parameter is always being received as null
.
Is not it just enough to tell ... / 1 to the end of the URL? How can I then send the id that I want to filter?
The template is as follows:
public partial class Tab_Documentos_Parente
{
public int Id { get; set; }
[Display(Name = "Nome do Parente")]
public int Id_Parente { get; set; }
[Display(Name = "Descrição do Documento")]
public Nullable<int> Id_Documento { get; set; }
[Display(Name = "Documento")]
[DataType(DataType.Upload)]
public byte[] Documento { get; set; }
public virtual Tab_Documentos_Cadastrais_Par Tab_Documentos_Cadastrais_Par { get; set; }
public virtual Tab_Parente Tab_Parente { get; set; }
}