You are looking for a similar solution effect like updatepanel in web forms, but for MVC below is a little about my problem in particular. I am sure that there are many ways to do this, but ideally I want the best and most correct way.
I reviewed this question , but could not get it to work.
Update:
It could be a postback; MVC equivalent. I just need the position of the page maintained for the user's perspective.
I tried the following on my index page, but did not play dice.
@section Scripts
{
<script type="text/javascript">
window.scrollTo = function( x,y ) {
return true;
}
</script>
}
Also like:
controller
ViewBag.JumpTo = "equipmentAnchor";
return RedirectToAction("Index");
Index
<div id="equipmentAnchor"></div>
@section Scripts
{
<script type="text/javascript">
$(document).ready(function () {
var JumpTo = '@ViewBag.JumpTo';
if (JumpTo != "") {
$(this).scrollTop($('#' + JumpTo).position().top);
}
});
</script>
}
What is the best / easiest way to achieve this?
, AJAX , , CSS ( ). JQuery - , , , , , .
, . , , .
/ , , , , ?
:
<div class="List">
@{Html.RenderPartial("View", Model.List);}
</div>
@using (Html.BeginForm("RemoveExisting", "PA_4"))
{
if (Model != null)
{
foreach (var ri in Model)
{
<div class="ui-grid-c ui-responsive">
<div class="ui-block-a">
<p>One</p>
<span>
@ri.One
</span>
</div>
<div class="ui-block-b">
<p>Two</p>
<span>
@ri.Two
</span>
</div>
</div>
}
}
if (Model.Count() > 0)
{
<div>
<input type="submit" value="Remove"/>
</div>
}
}