Buscar contenidos

lunes, 25 de junio de 2018

How to pass parameter to partial view in MVC4 razor

https://stackoverflow.com/questions/16648746/how-to-pass-parameter-to-partial-view-in-mvc4-razor


Use the below code in your javascript and Load your view from javascript function
var url = '@Url.Action("MyPartialView", "MyController")';
url += '/?Id=' + TestId ;
$("#tab1").load(url); 
Put the below Code in your Controller
public ActionResult MyPartialView( int id )
{
    return Partial( "MyPartialView", id );
}
Hope this helps

No hay comentarios:

Publicar un comentario