Click here to Skip to main content
15,891,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:


VB
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()



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:

XML
<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
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900