How can i reload a Razor View with a javascript call and switch the model ?

DanielWeigertDanielWeigert ATMember

Hello,

I have created a Razor View with a special model and I would like to use that for many Views.
The model is always the same but it contains a List which i would like to show up in the View and if i click a HTML element which has the id of one list-object I would like to reload the Razor Template with the new List object.

The code is listed below:

                @{
                    var currentModel = Model;
                }


                <div class = "row">
                    <span class="col col-xs-8 col-md-8" id="@Model.Action" onclick="goDeeperLevel()">@Model.Action</span>
                    <span class="col col-xs-4 col-md-4" >@Model.Values.Sum()</span>
                </div>

                function goDeeperLevel()
                {
                    currentModel = Model.Children[0]; <-----does not work
                    location.reload(); <---- does not work
                }
Sign In or Register to comment.