[kendo UI] Grid에서 EditorTemplateName 사용법
@(Html.Kendo().Grid<Com.Model.View.MyBiz.ServiceFee>() 
.Name("grdCenterFee_" + @Model.m_ContDetail[i].Year) 
.TableHtmlAttributes(new { @class = "list_2" }) 
.Columns(columns => 
{ 
   columns.Bound(c => c.ConID).Hidden(); 
   columns.Bound(c => c.Name).Title("지명").Width("20%"); 
   columns.Bound(c => c.CName).Title("기관").Width("30%"); 
   columns.Bound(c => c.CFeeAmt).Title("Fee").Width("20%").EditorTemplateName("Template_Amt")
                              .ClientTemplate("#=kendo.format('{0:n0}원', CenterFeeAmt)#"); 
   columns.Bound(c => c.Comment).Title("비고").Width("65%").EditorTemplateName("Template_textArea");
   columns.Bound(c => c.SupportStartDate).Title("지원가능시작일").Filterable(false) 
                                               .Format("{0:yyyy-MM-dd}") 
                                               .EditorTemplateName("StartDate");
   columns.Bound(c => c.VacName).Title("무기명").EditorTemplateName("Template_VacName") 
                                                    .EditorViewData(new { ComID = 1, Year = 2019 }).Width("10%");
   columns.Command(command => { command.Edit().Text("수정")
                                                   .UpdateText("저장")
                                                   .CancelText("취소"); 
                                                  command.Destroy().Text("삭제"); }).Width("30%"); 
}) 
.Editable(editable => editable.Mode(GridEditMode.InLine).DisplayDeleteConfirmation("삭제하시겠습니까?")) 
.DataSource(dataSource => dataSource 
   .Ajax() 
   .PageSize(20) 
   .Model(model => 
   {  
       model.Id(p => p.SeqID); 
       model.Field(p => p.Name).Editable(false); 
       model.Field(p => p.CName).Editable(false); 
   }) 
   .Events(events => events.RequestEnd("ChangeServiceFee").RequestStart("showLoadingIcon")) 
   .Read(read => read.Action("GetList", "MyBiz", new { ConID = @Model.m_ConDetail[i].ConID })) 
   .Update(update => update.Action("UpdateServiceFee", "MyBiz")) 
   .Destroy(destroy => destroy.Action("DeleteServiceFee", "MyBiz")) 
 ) 
) 
function ChangeServiceFee(e) { 
   if(e.response.Errors == null) 
   { 
     if (e.type == "update") { 
       alert("수정완료 되었습니다"); 
       if(e.sender._data.length > 0) 
       { 
          var id = "#grdCenterFee_" + e.sender._data[0].Year; 
          kendo.ui.progress($(id), false); 
       } 
       e.sender.read(); 
    } 
    if (e.type == "destroy") { 
      alert("삭제완료 되었습니다"); 
      e.sender.read(); 
    } 
  }
}
function showLoadingIcon(e) { 
     if(e.sender._data.length > 0) 
     {   
        var id = "#grdCenterFee_" + e.sender._data[0].Year; 
        kendo.ui.progress($(id), true); 
     } 
}
[Template_Amt.cshtml]
@model int 
   < script> 
       $(document).ready(function () { 
           $("#amt").kendoNumericTextBox({ 
               format: "{0:n0}", 
               decimals: 0, 
               min: 0, 
               max: 9999999, 
               step: 1000, 
               culture: "ko-KR" 
           }); 
       });  
</ script> 
@Html.TextBoxFor(m => m, new { @id = "amt", @class = "k-input", @maxlength = "7", @style = "width: 110px;" })원
[Template_textArea.cshtml]
@model string 
@Html.TextAreaFor(m => m, new {@id = "amt",  @class = "intext", cols = "100", rows = "5", }) 
//DatePicker 사용시 
[StartDate.cshtml]
@model DateTime? 
@(Html.Kendo().DatePickerFor(m => m) 
   .Name("StartDate") 
   .HtmlAttributes(new { @style = "width:100px;" }) 
   .Format("{0:yyyy-MM-dd}") 
   //.Format("{0:" + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern + "}") 
   .Culture("ko-KR") 
   .ParseFormats(new string[] { "yyyy-MM-dd" }) 
)
//서버 사이드에서 데이터를 내려받아와 콤보박스에 사용하고자 할 경우
[Template_VacName.cshtml]
@(Html.Kendo().ComboBox() 
    .Name("LibID") 
    .Placeholder("-선택하세요-") 
    .SelectedIndex(0) 
    .DataTextField("KeyValue") 
    .DataValueField("KeyCode") 
    .Value("-선택하세요-") 
    .HtmlAttributes(new { style = "width: 150px;" }) 
.DataSource(source => 
{ 
    source.Read(read => 
    { 
        read.Action("VacNameFilterData", "Caccine", new { ComID= ViewData["ComID"], Year = 2019}); 
    }) 
.ServerFiltering(true); 
}) 
)
[Server Side]
[HttpPost] 
public bool UpdateServiceFee([DataSourceRequest] DataSourceRequest request, Com.Model.View.MyBiz.ServiceFee item) 
{ 
   try 
   { 
     DataParameter dp = new DataParameter(); 
     dp.Add("SeqID", item.SeqID); 
     _repository.Update("UpdateServiceFee", dp); 
return true;
   } 
   catch (Exception ex) 
   { 
      return false; 
   } 
}
DisplayDeleteConfirmation("삭제하시겠습니까?"))를 사용하여 한글화하였다. 미사용시 
"Are you sure you want to delete this record?" 메세지가 노출된다.
 

