views:

55

answers:

1

In views i`m passing model strongly typed way like this:

System.Web.Mvc.ViewPage<HomeModel>

And then just use it:

<%= Model.Greeting %>

How it would be possible to use strongly typed model in layout?

Without strongly typing i would probably add necessary data at controller factory, then use it through (LayoutModel)Viewdata["LayoutModel"]).Tralala, but i`m looking for better way.

+1  A: 

Create strongly typed property in your View:

<script runat="server">
    protected LayoutModel LayoutModel
    {
        get
        {
            return ViewData["LayoutModel"] as LayoutModel;
        }
    }
</script>
eu-ge-ne
It's a bit better, but still not what i`m looking for.
Arnis L.
Haven't found anything better so far. :/
Arnis L.
..... I'm too :<
eu-ge-ne