How to simulate IsStartupScriptRegistered in ASP.NET MVC
3 answers
Simple enough, you can do some custom js code changes. It can display content at the end of the page and mainatin a series of Key-value fierls. So when you do cjeck for! IsStartupScriptRegistered (), use the Key as parameter. Pretty simple. So I can mention some custom implementations here for this thing, but I don't want to :) try to do it manually, I know you will like it! good luck
+1
a source to share
I assume there is no 1: 1 copy of this feature.
Some codes:
<%@ Control Language="C#"
Inherits="System.Web.Mvc.ViewUserControl<IList<Item>>" %>
<script src="../src/preciousJavascript.js" type="text/javascript"/>
<%foreach (var item in Model){%>
<% Html.RenderPartial("_Item",item); %>
<%}%>
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Item>" %>
<%=Item.Name %>
Maybe it clears something
0
a source to share
It might help, though more for script references than running the script (read the section on resource tracking). http://stephenwalther.com/blog/archive/2008/08/22/asp-net-mvc-tip-36-create-a-popup-calendar-helper.aspx
0
a source to share