I'm struggling with navigation in asp.net mvc and URLs.
When you are visiting your profile at Facebook, the url is facebook.com/yourusername. At your profile there is a menu with the following links: Timeline, About, Friends etc.
When you click on one of these links, for example Photos
, the URL is changed to facebook.com/yourusername/Photos, and the photos are rendered. The menu described above are still there, and so also the profile picture and the cover picture. Its like a partial view has rendered viewing the photos.
I want to accomplish this effect in my project, but I don't know how to do it. I have tried to do it with Partial view
but the problem is that the URL is not changed when the partial view is rendered.
How should I structure it?
My Index.cshtml that belongs to Home-controller
looks like this:
div class="centering col-lg-7 logged_in_mainboxes" style="padding: 0; position: relative">
<div class="col-lg-12 coverPicture" style="background-image: url('/Content/Images/@Model.CoverPicture');">
<div id="image-cropper">
<div class="cropit-preview"></div>
<h3 class="coverPicTextStyle">
@Model.Name
</h3>
<button type="submit" id="uploadCoverpicture" class="btn_style_2 btn" style="position: absolute; bottom: 10px; right: 10px;">Upload</button>
<button type="submit" id="crop" class="btn_style_2 btn" style="position: absolute; bottom: 50px; right: 10px; display: none;">Done</button>
<input type="file" class="cropit-image-input" id="coverUpl" style="display: none;" />
</div>
<div class='progress' id="progress_div">
<div class='bar' id='bar1'></div>
<div class='percent' id='percent1'></div>
</div>
<input type="hidden" id="progress_width" value="0">
</div>
<div class="col-lg-12 pull-left">
<div class="user_menu">
<ul>
<li>@Html.ActionLink("Wall","Wall","Home")</li>
<li>@Html.ActionLink("Music", "Music", "Home")</li>
<li>@Html.ActionLink("Photos", "Photos", "Home")</li>
<li>@Html.ActionLink("Videos", "Videos", "Home")></li>
<li>@Html.ActionLink("About", "About", "Home")</li>
</ul>
</div>
</div>
<div class="col-lg-7 pull-left" style="margin-top: 15px;">
</div>
<div class="col-lg-3 pull-right" style="border-left: 1px solid #ddd; margin-top: 15px; ">
asdasd
</div>
</div>