Ajax form view issue, asp.net mvc 3

gkZeDtrn

New Member
I want to add some ajax to my forms. Here is the main view:\[code\]<script src="http://stackoverflow.com/questions/14509070/@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script><script src="http://stackoverflow.com/questions/14509070/@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script><script src="http://stackoverflow.com/questions/14509070/@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>// here I display each post from Posts collection@foreach (var post in Model.Posts){ <div><div> <strong> Title: @post.Title </strong></div><div>@post.Text</div><div>Posted by: @post.User.UserName</div><div>Posted Date: @post.CreatedDate</div>@{ var membershipUser = Membership.GetUser(); }@if (membershipUser != null){ var providerUserKey = membershipUser.ProviderUserKey; if (providerUserKey != null && post.CreatedBy == (Guid) providerUserKey) { <div style="display: none; color: red;" id="postEditLoading">Loading..</div> <p id="postEdit"> // EditPost method returns edit view asynchronously @Ajax.ActionLink("Edit", "EditPost", new {id = post.PostId, @class = "averageLink"}, new AjaxOptions {UpdateTargetId = "postEdit", LoadingElementId = "postEditLoading", LoadingElementDuration = 3000}) @Html.ActionLink("Delete", "DeletePost", new {id = post.PostId}, new {@class = "averageLink"}) </p> }}\[/code\]Everything works, except for this strange thing: the form that is returned by EditPost method appeares right below first post, whether I wanna edit first or last post.How could I fix this, so the form will appear below the post I want to edit??Thanks for help in advance!
 
Back
Top