My problem: drop down list at layout page.
I've read this post: ASP.NET MVC Razor pass model to layout it's more or less similar to my problem. In one of comments Mattias Jakobsson wrote that: "But a common solution is to use RenderAction to render parts that need their own data in the layout page". So ok I've created layout page with @Html.Action() that render my drop dwon list with a date from the db. Everything's perfect. But...
- I have two pages, for example: 'Home', 'About' and my drop down list (ddl) at layout page
- How to achive that when I'm at 'Home' and I changed selection in ddl it refresh 'Home' page and when I'm at 'About' it refresh 'About' page.
- How to store selected ddl value through pages?
Part of Layout.cshtml code:
    .
    .
    <body>
    <header id="top" class="grid-full-margin">
        <strong id="logo" class="grid-304"><a href="/"><img src="/images/logo.png" ></a></strong>
        @Html.ActionLink(@Resources.Resource.BackToIntranet, "Index", "Home", null, new {@class = "link link-home grid-position-left"})
        <h1>@Resources.Resource.SiteTitle</h1>
        <a href="#" class="link link-help">@Resources.Resource.LayoutHelp</a>
        <nav clss="grid-896">
            <ul>
                <li>@Html.ActionLink(Resources.Resource.LayoutMenuItem1, "Index", "Home")</li>
                <li>@Html.ActionLink(Resources.Resource.LayoutMenuItem2, "Index", "ClimaticStation")</li>
                <li>@Html.ActionLink(Resources.Resource.LayoutMenuItem3, "Index", "ClimaticPoint")</li>
                <li>@Html.ActionLink(Resources.Resource.LayoutMenuItem4, "Index", "IcewaterExchanger")</li>
                <li>@Html.ActionLink(Resources.Resource.LayoutMenuItem5, "Index", "Pipeline")
                    <ul>
                        <li>@Html.ActionLink("Zestawienie", "YearsLength", "Pipeline")</li>
                    </ul>
                </li>
            </ul>
            <div class="mod-select-list tbl-actions">
                @Html.Partial("~/Views/Shared/Partials/LoginPartial.cshtml")
            </div>
        </nav>
    </header>
    <form action="#">
        @Html.Action("VariantsDdl", "MyBase")
    </form> 
    @RenderBody()
    .
    .
Part of MyBaseController.cs
   public class MyBaseController : Controller
{
   [ChildActionOnly]
    public ActionResult VariantsDdl()
    {
        var dataFromDb = GetDataFromDB(); // it's not importstn right now
        return this.PartialView("~/Views/Shared/Partials/VariantsDdlPartial.cshtml", dataFromDb);
    }
   .
   .
   }
Regards, Marcin
 
    