Monday, December 20, 2010

How to improve ASP.Net Performance 3: html view

- Keep StyleSheets in the Header and Scripts to the end of Document
- Keep JavaScript and CSS External
- Turn Off ViewState if possible
  <%@ Page EnableViewState = "false" %>
- Disable Session State if possible
  <%@ Page EnableSessionState= "false" %>

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