I am new to mvc. I want to add a partial view in my layout page. for this i created an action method for partial view and using this action i craeted a partial view. I want to add this partial view in all my other views...How can we do this
this is my action for partial view
public ActionResult _PartialIndex()
{
IList<LawyerModel> lawyerList = new List<LawyerModel>();
var query = (from lawyer in context.law_advocates
orderby lawyer.AdvocateID ascending
select lawyer).Take(35);
var lawyerimg = query.ToList();
foreach (var lawyerdata in lawyerimg)
{
lawyerList.Add(new LawyerModel()
{
AdvocateID = lawyerdata.AdvocateID,
ImageID = lawyerdata.ImageID,
ImagePath = "~/MemPhoto/" + lawyerdata.ImageID
});
}
return PartialView(lawyerList);
}