2017-01-17 69 views
0

我有一個kendo網格,返回除第一列(日期)以外的所有結果。它顯示爲空白。在我的viewmodel中,reviewdate是字符串類型。在我的控制器中,我將reviewdate轉換爲一個字符串。我知道reviewdate從調試中返回MM/dd/yyyy。MVC kendogrid不顯示日期時間字符串值

控制器片段:

foreach (var item in query) 
{ 
    model.Add(new PreviousReviewViewModel() 
    { 
     ReviewId = item.ReviewId, 
     ReviewDate = item.NextReviewDt.ToString("MM/dd/yyyy"), 
     Rating = item.Rating, 
     SubmittedFl = item.SubmittedFl 
    }); 

} 

在我看來,我有網格如下:

@(Html.Kendo().Grid<PreviousReviewViewModel>() 
     .Name("Grid") 
     //.HtmlAttributes(new { style = "width:450px;" }) 
     .Columns(columns => 
     { 
      columns.Template(
      @<text> 
       @Html.ActionLink(Model.ReviewDate, "SavedFormsIndex", new { Controller = "Forms", id = Model.ReviewId }) 
      </text>).ClientTemplate(@"<a href=""/Forms/SavedFormsIndex?id=#=ReviewId#""></a>").Title("Review Date"); 
      columns.Bound(m => m.Rating).Title("Composite Rating"); //rating is the avg 
      columns.Bound(m => m.SubmittedFl).Title("Submitted"); 
     }) 
     .Pageable(p => p.Numeric(false).PreviousNext(false).Refresh(true)) 
     .Resizable(resize => resize.Columns(true)) 
     .Scrollable() 
     .DataSource(dataSource => dataSource 
      .Ajax() 
      .PageSize(2147483647) 
      .Read(read => read.Action("read_PrevProjReviews", "Forms", new { id = ViewBag.ProjectId })) 
    ) 
+0

[參考這裏(HTTP:/ /www.telerik.com/forums/template-columns-not-displaying-data)以及該頁面上的鏈接 - 注意:'之間沒有文字'標籤 –

回答

0

試着改變你的客戶端模板

.ClientTemplate(@"<a href=""/Forms/SavedFormsIndex?id=#=ReviewId#"">#=ReviewDate#</a>