Monday, December 20, 2010

How to redirect to another Controller/Action in Javascript (ASP.NET/MVC)

1. By html button
<input type="button" name="cmd" onclick="javacript: window.location='<%= Page.ResolveUrl("~/EventName/ActionName/"+ViewData["Id"].ToString()) %>';" value="Go" />
2. Set two forms, and use Redirection in Controller

2 comments:

  1. When designing a web site, many times you must change the location of a web page. However, if the page is popular, your visitors may have already linked to it. In addition, the Search Engines have most-likely already indexed the page.
    http://www.usedcomputersfromwarehouse.com/

    ReplyDelete