2015-10-15 58 views
0

我的編輯按鈕通過單擊編輯按鈕消失。 正常情況下,他們應該自動轉爲保存和取消按鈕。 通過單擊編輯按鈕,我的div(idCustomerTemplate)中的全部內容將被編輯器模板替換。MVC Kendo ListView編輯和刪除按鈕消失

Telerik網站說: 注意:類名爲k-update-button和k-cancel-button的元素的點擊事件將被Kendo ListView自動處理和處理爲保存和取消操作。編輯器模板應該包裝在HTML容器中,與項目模板相同。

任何人都有我的提示嗎?

<script type="text/x-kendo-tmpl" id="idCustomerTemplate"> 
     <div class="clsCustomerListView"> 
      <dl> 
      <dt>Firmenname</dt> 
      <dd>#=CompanyName#</dd> 
      <dt>Adresse</dt> 
      <dd>#=Adress#</dd> 
      <dt>Postleitzahl</dt> 
      <dd>#=ZipCode#</dd> 
      <dt>Ort</dt> 
      <dd>#=Location#</dd> 
      <dt>Land</dt> 
      <dd>#=Country#</dd> 
      </dl> 
      <div class="edit-buttons"> 
      <a class="k-button k-edit-button" href="\\#"><span class="k-icon k-edit"></span></a> 
      <a class="k-button k-delete-button" href="\\#"><span class="k-icon k-delete"></span></a> 
      </div> 
     </div> 
    </script> 

回答

0

This可能會幫助你在asp.net mvc的劍道電網的在線編輯。

@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.ProductViewModel>() 
    .Name("grid") 
    .Columns(columns => 
    { 
     columns.Bound(p => p.ProductName); 
     columns.Bound(p => p.UnitPrice).Width(100); 
     columns.Bound(p => p.UnitsInStock).Width(100); 
     columns.Bound(p => p.Discontinued).Width(100); 
     columns.Command(command => { command.Edit(); command.Destroy(); }).Width(172); 
    }) 
    .ToolBar(toolbar => toolbar.Create()) 
    .Editable(editable => editable.Mode(GridEditMode.InLine)) 
    .Pageable() 
    .Sortable() 
    .Scrollable() 
    .HtmlAttributes(new { style = "height:430px;" }) 
    .DataSource(dataSource => dataSource 
     .Ajax() 
     .PageSize(20) 
     .Events(events => events.Error("error_handler")) 
     .Model(model => model.Id(p => p.ProductID)) 
     .Create(update => update.Action("EditingInline_Create", "Grid")) 
     .Read(read => read.Action("EditingInline_Read", "Grid")) 
     .Update(update => update.Action("EditingInline_Update", "Grid")) 
     .Destroy(update => update.Action("EditingInline_Destroy", "Grid")) 
    ) 
)