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. I tried some answers i found on similar questions but i got the following output:
"my_app.Models.DogTreatments" . Can anyone tell me why is that?
Here is my code:
Controller:
[HttpPost]
public ActionResult CasIndex(int Sid)
{
string treat = dbContext.DogTreatments.Where(x => x.Sid == Sid).SingleOrDefault().ToString();
// ViewBag.TList = dbContext.DogTreatments.Where(x => x.Sid == Sid);
return PartialView("DisplayTreatments", treat);
}
View page:
@Html.Partial("~/Views/Shared/DisplayTreatments.cshtml")
Partial view:
@model string
@{
Layout = null;
}
@Model