I want to pass a string variable to a partial view but im not sure how to display the string parameter to the partial view. Can anyone help me?
Here is my code:
Controller:
[HttpPost]
public ActionResult CasIndex(int Sid)
{
string treat = dbContext.DogTreatments.Where(x => x.Sid == Sid).FirstOrDefault().ToString();
// ViewBag.TList = dbContext.DogTreatments.Where(x => x.Sid == Sid).ToList();
return PartialView("DisplayTreatments", treat);
}
View page:
@Html.Partial("~/Views/Shared/DisplayTreatments.cshtml")
Partial view:
@model string
@{
Layout = null;
}
@Model