本文介绍了在mvc telerik中实现clienttemplate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



阿罗哈!



我想询问我怎么能在MVC Telerik上的kendo模板下的CreateDate字段上实现ClientTemplate就像在telerik网格中一样



这是来自telerik网格的模式代码:

$ / b


Hi to All,

Aloha!

I would like to ask on how could I implement "ClientTemplate" on "CreateDate" field under kendo template on MVC Telerik just like in telerik grid

Here's the pattern code from telerik grid:


Html.Kendo().Grid(Of SPIMS.ViewModel.EventViewModel.Index)() _
              .Name("grid") _
              .Columns(Sub(c)
                               c.Bound(Function(p) p.ID).HeaderHtmlAttributes(New With {.style = "text-align: center; font-weight: bold"}).Width(10)
                               c.Bound(Function(p) p.CreatedDate).Width(20).Title("Date").HeaderHtmlAttributes(New With {.style = "text-align: center; font-weight: bold"}).ClientTemplate("#=CreatedDate ? kendo.format('{0:dd-MMM-yy}', kendo.parseDate(CreatedDate)) : ''#")
                               c.Bound(Function(p) p.Source).HeaderHtmlAttributes(New With {.style = "text-align: center; font-weight: bold"}).Width(20)
                               c.Bound(Function(p) p.Message).HeaderHtmlAttributes(New With {.style = "text-align: center; font-weight: bold"}).Width(50).Title("Description")
                               c.Command(Sub(commands)
                                                 commands.Custom("View").Click("showDetails")
                                         End Sub).Title(" ").Width(10)
                       End Sub) _
              .Pageable(Sub(pager)
                                pager.Input(True)
                                pager.Numeric(True)
                                pager.Input(True)
                                pager.PreviousNext(True)
                                pager.Refresh(True)
                                pager.PageSizes(True)
                                pager.ButtonCount(10)
                        End Sub) _
              .Sortable(Function(sorting) sorting.AllowUnsort(True)) _
              .Filterable() _
              .Scrollable() _
              .HtmlAttributes(New With {.style = "height:450px;width:900px;"}) _
              .DataSource(Sub(d)
                                  d.Ajax() _
                                  .PageSize(10) _
                                  .Model(Sub(model) model.Id(Function(p) p.ID)) _
                                  .ServerOperation(True) _
                                  .Read(Function(read) read.Action("Model_Read", "Event"))
                          End Sub).Render()







基于以上代码,我想实现此代码片段:



.ClientTemplate(#= CreatedDate? kendo.format('{0:dd-MMM-yy}',kendo.parseDate(CreatedDate)):''#)



# = CreatedDate#



请参阅以下完整代码:






Based on above code, I would like to implement this code snippet:

.ClientTemplate("#=CreatedDate ? kendo.format('{0:dd-MMM-yy}', kendo.parseDate(CreatedDate)) : ''#")

to #= CreatedDate #

see complete code below:

<script type="text/x-kendo-template" id="template">
          <div id="details-container">
              <div id="hand_left" style="float:left; width:100px;height:150px">
                  <br />
                  <i>ID: </i>
                  <br /><br />
                  <i>Date: </i>
                  <br /><br />
                  <i>Source: </i>
                  <br /><br />
                  <i>Description: </i>

              </div>
              <div id="hand_right" style="text-align:left;width:380px">
                  <br />
                  <b>#= ID #</b>
                  <br /><br />
                  <b>#= CreatedDate #</b>
                  <br /><br />
                  <b>#= Source #</b>
                  <br /><br />
                  <b>#= Message #</b>
              </div>
          </div>
      </script>







提前感谢您的帮助,上帝保佑




Thank you in advance for your kind help and God bless

推荐答案

这篇关于在mvc telerik中实现clienttemplate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 21:07