- Where Developers Learn, Share, & Build Careers
I have an ASP.NET MVC4 project with ESP. In my (create) view I have a week of current year I want to show in front of an editor for the date.
I have a helper:
@ Model Helios model. Tablename @ helper week (date time dt) {CultureInfo ciCurr = CultureInfo.CurrentCulture; Int weekNum = ciCurr.Calendar.GetWeekOfYear (DT, Calendar WeekRule.FirstFourDayWeek, DayOfWeek.Monday); @weekNum} ... & lt; Div class = "editor-field" & gt; @ Html.TextBoxFor (model = & gt; model.date_birth, new {onchange = "?"}) @Week (date_birth?) & Lt; / Div & gt; I'm not sure that this may be a complete razor, but if I change the date
Q : How can I display any number of weeks. Next to Datepicker And if the date has changed?
week number.
< / P>
But it all depends on it if you plan to install it on the server If the customer can change the date, then you will need JavaScript instead.
function (d) {var day = d.getDay () ; If (days == 0) day = 7; D.setDate (d.getDate (+ + 4-day)); Var year = d.getFullYear (); Var ZBDoCY = Math.floor ((d.getTime ( ) - New date (year, 0, 1, -6)) / 86400000); 1 + Math.floor return (ZBDoCY / 7);} to: < / Div>
Comments
Post a Comment