2011-11-17 2 views
1

私はglimpseがインストールされたMVCアプリケーションを持っていますが、私はまた、ダイナミック検証にMVCControlToolkitを使用しています。Glimpseを使用してMVCコントロールツールキットを使用するとMVC3ビューが2回レンダリングされるDateTimeFor要素

問題は、DateTimeForを使用して日付時刻のカレンダーを表示し、非常に限られた状況の場合のみです(これは発生しないdatetime要素がある場合のみです)。 bodyはページ上で2回レンダリングされます。

レンダリングが何かによって再開されているようですが、私はそれを解決できませんでした。

任意の助けをいただければ幸いです

マイビューコードは、私たちはこの問題を修正したと信じて

@using LeaveTracker.Models 
@using LeaveTracker.Models.Leave 
@using MVCControlsToolkit.Controls 
@using MVCControlsToolkit.Controls.Validation 
@model LeaveTracker.Models.Leave.LeaveAllocation 

@{ 
    ViewBag.Title = "Edit"; 
    Layout = "~/Views/Shared/_LayoutMaintenance.cshtml"; 
} 

@Html.AntiForgeryToken() 
<div class="page-header"> 
<h1>  
    Edit Leave Allocation 
    @if (Model.ID > 0) { <small> @Model.TypeOfLeave.Name till @Model.AppliesUntil.ToString("dd/MM/yyyy")</small> } 
</h1> 
</div> 

<div> 
    @Html.ActionLink("Back to List", "Index") 
</div> 

<link href="@Url.Content("~/Content/themes/base/jquery-ui.css")" rel="stylesheet" type="text/css" /> 
<link href="@Url.Content("~/Content/themes/base/jquery.ui.datepicker.css")" rel="stylesheet" type="text/css" /> 
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.16.min.js")" type="text/javascript"></script> 
@Html.JQueryDatePickerGlobalizationScript("en-GB") 
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> 
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> 
<script src="@Url.Content("~/Scripts/ValidationSetup.js")" type="text/javascript"></script> 
<script src="@Url.Content("~/Scripts/MVCControlToolkit.Controls-1.5.0.js")" type="text/javascript"></script> 

@using (Html.BeginForm()) { 

    @Html.ValidationSummary(true) 

    <fieldset> 
     <legend>Leave Allocation Details</legend> 

     @Html.HiddenFor(model => model.ID) 

     <div class="clearfix"> 
      @Html.LabelFor(model => model.TypeOfLeave) 
      <div class="input"> 
       @Html.DropDownListFor(model => model.TypeOfLeave, 
         LeaveFactory.GetAllLeaveTypes().Select(fl => new SelectListItem 
         { 
          Text = fl.Name, 
          Value = fl.ID.ToString() 
         })) 
       <span class="help-inline">@Html.ValidationMessageFor(model => model.TypeOfLeave)</span> 
      </div> 
     </div> 

     <div class="clearfix"> 
      @Html.LabelFor(model => model.AppliesFrom) 
      <div class="input"> 
       @Html.DateTimeFor(model => model.AppliesFrom, DateTime.Today, true).DateCalendar(
        inLine: false, 
        calendarOptions: new CalendarOptions 
        { 
         ChangeYear = true, 
         ChangeMonth = true 
        })     
       <span class="help-inline">@Html.ValidationMessageFor(model => model.AppliesFrom)</span> 
      </div> 
     </div> 

     <div class="clearfix"> 
      @Html.LabelFor(model => model.AppliesUntil) 
      <div class="input"> 
       @Html.DateTimeFor(model => model.AppliesUntil, DateTime.Today, true).DateCalendar(
        inLine: false, 
        calendarOptions: new CalendarOptions 
        { 
         ChangeYear = true, 
         ChangeMonth = true 
        })     
       <span class="help-inline">@Html.ValidationMessageFor(model => model.AppliesUntil)</span> 
      </div> 
     </div> 

     <div class="clearfix"> 
      @Html.LabelFor(model => model.DefaultAllocation) 
      <div class="input"> 
       @Html.EditorFor(model => model.DefaultAllocation) 
       <span class="help-inline">@Html.ValidationMessageFor(model => model.DefaultAllocation)</span> 
      </div> 
     </div> 

    </fieldset> 

    <fieldset> 

     <legend>Leave Carried Over</legend> 

     <div class="clearfix"> 
      @Html.LabelFor(model => model.MaxCarriesOver) 
      <div class="input"> 
       @Html.EditorFor(model => model.MaxCarriesOver) 
       <span class="help-inline">@Html.ValidationMessageFor(model => model.MaxCarriesOver)</span> 
      </div> 
     </div> 

     <div class="clearfix"> 
      @Html.LabelFor(model => model.LeaveUseByDate) 
      <div class="input"> 
       @Html.DateTimeFor(model => model.LeaveUseByDate, DateTime.Parse("01/01/1900"), true).DateCalendar(
        inLine: false, 
        calendarOptions: new CalendarOptions 
        { 
         ChangeYear = true, 
         ChangeMonth = true 
        })    
       <span class="help-inline">@Html.ValidationMessageFor(model => model.LeaveUseByDate)</span> 
       <span class="help-block">The year on this field doesn't matter, only the month and day will be taken into account</span> 
      </div> 
     </div> 

     <div class="actions"> 
      @Html.ActionLink("Cancel", "Index", null, new { @class = "btn" })    
      <input class="btn primary" type="submit" value='Save'> 
     </div> 

    </fieldset> 
} 
+0

から利用可能になりました - 新しいビットがうまくいけば、あなたの問題を解決するであろう釈放されました。 – nikmd23

答えて

3

リー、

です。そしてもう少しテストを - -

あなたは私たちが確認を取得した場合、これはあなたの問題を修正することをテストしhttp://www.myget.org/F/getglimpse/

でMyGetから垣間見る0.87のアルファビルドをインストールすることでご確認くださいすることができ、我々は、メインNuGetにリリースします.orgリポジトリ。

EDIT 垣間見るバージョン0.87は、私は私の答えを更新しましたメインNuGet.org Glimpse feed

+0

長い返信をおかけして申し訳ありません。これは私の問題を修正したようです。ありがとう –

+0

バージョン0.87は私の繰り返し体の問題も解決しましたが、私はDateTimeForを使用していませんし、マークアップのかなり愚かなページを持っています。これがメインのnuget.orgフィードに公開されるときの考えはありますか? –

+0

NuGet.orgに0.87を送りました。ありがとう! – nikmd23

関連する問題