Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Building Navigation Rules

$
0
0

I'm going to use the default ASP.NET Core web application _Layout.cshtml as my example. It creates the following navigation bar:

<ul class="nav navbar-nav"><li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li><li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li><li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li></ul>

Imagine there is a form on each tab and we want the user to complete the forms in order (Home > About > Contact) without skipping over an "incomplete" tab. However, if the user had completed Home and About, they would be able to skip from Home to Contact.

My thought is to create a persistent stored string on application load which has the "tab" state (X for incomplete, C for complete). So initially, TabState would be `XXX` and would update as needed.

My question is, how can I prevent/allow navigation depending on this TabState? Is this something that I can do in the controllers or would I need to do this logic somewhere else?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>