There is a form for adding an entry. How can I display the lower area of ​​the page when reloading the page?

Now there is such an implementation:

public ActionResult CreateReview(GuestbookReview review) { review.DateAdded = DateTime.Now; db.GuestbookReviews.Add(review); db.SaveChanges(); return new RedirectResult(Url.Action("Index") + "#post"); } 

at the bottom of the page posted: div name = "# post"

But for some reason this method does not work, no action takes place ...

    1 answer 1

    Not a name , a id . And the Hashtag is not needed:

    <div id="post" ...

    • Yes, all the examples that looked all went with the hashtag and name = ""))) - Macro
    • Now another question arose, is it possible to use @ Model.Id as an example instead of "#post"? - Macro
    • @Macro can be: <div id="<%= Model.Id %>" ... - Igor
    • I did not quite understand, now I have the objects <div id = "CreateComment @ (Model.Id)"> </ div> I tried return new RedirectResult (Url.Action ("Index") + "# CreateComment @ (Model.Id ) "); - Macro
    • @Macro return new RedirectResult(Url.Action("Index") + "#CreateComment" + <variable same as Model.Id in Index view>); - Igor