Posting a form with anchor link at the end?

Posted by Marcus on Stack Overflow See other posts from Stack Overflow or by Marcus
Published on 2010-03-14T09:41:50Z Indexed on 2010/03/14 9:45 UTC
Read the original article Hit count: 266

Filed under:

I have a form for comments like the one below but after the form is posted I wish to navigate to http://www.myurl.com/mypage#commentform but I don't know how to do this. Instead of changing my form maybe there is a way to return a View with my model and add #commentform to my url?

<div id="commentform">
    <h2>Leave a comment</h2>
    <% using (Html.BeginForm("Comment","Post", FormMethod.Post)) %>
    <% { %>
        <div>
            <%=Html.EditorFor(post => post.Comment) %>
            <div class="editor-button">
                <input type="submit" value="Comment" />
            </div>
        </div>            
    <% } %>    
</div>

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2