Hello
i want to navigate from 1 cshtml page to another inside app/tenant/view/store/page1.cshtml to app/tenant/views/store/page2.cshtml from a href tag
can you please show me how it is done
regards Anwar
6 Answer(s)
-
0
It's not clear what you mean. Views (.cshtml) are accessed through controller actions (a.k.a. methods). Your question seems to be asking about how ASP.NET works in general and not about this framework.
If you have 2 views, then you need one action for each:
public ViewResult Page1() { return View(); } public ViewResult Page2() { return View(); }
and Page1.cshtml will contain:
<a asp-action="Page2">Go to Page 2</a>
If you mean pagination, i.e. display different items using the same view template, then you should accept one action:
public ViewResult Page(int num) { return View(num); }
and Page.cshtml will contain:
@model int <h1>This is page @Model.</h1>
which can be accessed by app/tenant/view/store/page?num=1 and app/tenant/view/store/page?num=2.
-
0
Hi aaron
thank you for your reply, what i mean is if you look at the path there are 2 pages both sitting under app/tenant/views/page1.cshtml and page2.cshtml what i wanted was navigate from page1 to page2 using url action.
Regards Anwar
-
0
Hi Anwar, if I look where?
-
0
under web project App |_________Tenants |_________________Views |____________MyFolder |___________________Page1.cshtml |____________________Page2.cshtml
page1.cshtml is already defined in the menu with all permissions, page 2 is not a link in the menu so i want to call page2 from page1 using a href .
Hope that helps
Regards Anwar
-
0
That doesn't look valid. Can you share an actual project with those files?
-
0
Thanks aaron,
Resolved it .