Configuring

Imagine we had an unruly collection of thingamabobs and wanted to build a web app for keeping track of them all. We'd probably start with a page that listed all our thingamabobs. We could then select an individual thingamabob to update its details.

States
To Navigation for ASP.NET, each of these pages is a state. We connect two states together using a transition and we group connected states together using a dialog. This information goes into the StateInfo.config file and for our thingamabob app this would look like

<dialog key="Thingamabobs" intial="Listing">
    <state key="Listing" route="listing">
        <transition key="Select" to="Details"/>
    </state>
    <state key="Details" route="details"/>
</dialog>

We set the dialog's 'initial' attribute to the Listing state because this is our first page. And we set the transition's 'to' attribute to the Details state because this is our second page. We associate each state to a Url via the 'route' attribute. We need a bit more configuration to decide whether we map a state to an MVC Controller or a Web Forms Page.

MVC

An MVC state requires controller and action attributes.

<dialog key="Thingamabobs" intial="Listing">
    <state key="Listing" route="listing" controller="Thingamabob" action="List">
        <transition key="Select" to="Details"/>
    </state>
    <state key="Details" route="details" controller="Thingamabob" action="GetDetails"/>
</dialog>

Web Forms

A Web Forms state requires a page attribute.

<dialog key="Thingamabobs" intial="Listing">
    <state key="Listing" route="listing" page="~/Listing.aspx">
        <transition key="Select" to="Details"/>
    </state>
    <state key="Details" route="details" page="~/Details.aspx"/>
</dialog>

Last edited Jul 11, 2014 at 12:10 PM by GrahamMendick, version 4