So here's a DateTime editor a la NerdDinner's /Views/Shared/EditorTemplates/DateTime.ascx:
%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.DateTime>" %>
<%: Html.TextBox("", String.Format("{0:yyyy-MM-dd HH:mm}", Model))%>
<script type="text/javascript">
$(function () {
$("#date").datepicker({ showOn: 'focus' });
});
</script>
Since this is a template that's going to be used possibly multiple times on a page, if I'm going to attach the datepicker to each TextBox, they each need a unique ID, and I need to be able to use them in the <script>.
What's the best way to go about doing this?