问问题
754 次
2 回答
1
想到的第一个想法=>
模板:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DateTime>" %>
<%: Html.TextBox(String.Empty, Model.ToString("M/dd/yyyy h:mm tt")) %>
<script type="text/javascript">
$(function () {
MakeSureAnyTimeIsIncluded();
$('#<%: ViewData.TemplateInfo.GetFullHtmlFieldId(String.Empty) %>').AnyTime_picker({
format: "%c/%d/%Y %l:%i %p"
});
});
</script>
母版页或共享的外部 JS 文件:
function MakeSureAnyTimeIsIncluded(){
if (!anyTimeIsIncluded)
//document.write(<script src="correct url") something like that
anyTimeIsIncluded=true;
}
于 2010-05-20T17:45:28.737 回答
1
在你的主人:
<asp:ContentPlaceHolder ID="Scripts" runat="server" />
在将使用 EditorTemplate/插件的视图 (aspx) 中:
<asp:Content ID="indexScripts" ContentPlaceHolderID="Scripts" runat="server">
<script type="text/javascript" src="anytime.js"></script>
</asp:Content>
于 2010-05-20T17:48:43.483 回答