Why is script tag defined in contentPlaceHolder not being added?
I am trying to dynamically add some javascript to my view in a contentPlaceHolder. For some reason the is never added. The foreach logic directly beneath is run however.
What's with that?
<asp:Content ID="Content3" ContentPlaceHolderID="DynamicIncludes" runat="server">
<script type="text/javascript" language="javascript">
alert("why am I not firing?");
</script>
<%foreach (var script in Model.DynamicIncludes)
{%>开发者_StackOverflow中文版;
<%=Html.ScriptTag(Url.Content(script))%>
<%} %>
</asp:Content>
Its important to remember to actually define the contentPlaceHolder in the master page. Duh.
精彩评论