Here is a partial views may display in many pages,and I use @Html.Partial to insert it to the page.
Now I want to change the text of partial views in controller.
Here is the code of index.cshtml:
@{
ViewData["Title"] = "Home Page";
}
@Html.Partial("Aside.cshtml")
Here is the code of HomeController:
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
public IActionResult About()
{
ViewData["Message"] = "Your application description page.";
return View();
}
public IActionResult Contact()
{
ViewData["Message"] = "Your contact page.";
return View();
}
public IActionResult Aside()
{
return View();
}
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
And here is the file list of my project:
When the project runs,and index.cshtml loaded,I found the IActionResult Aside() did not ran,but IActionResult Index() had ran.
As I said top of this question,I want to change the text of partial views(aside.cshtml) in controller,but now I can't for the IActionResult Aside() did not ran.
Why it did not ran?And how can I solve this problem?
Please help me,thank you.