开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜