Reputation: 809
I am Using KendoUI tool for my Application.In that I am Using a Kendo Grid in which a Toolbar is there on clicking which it shows me a Popup in that two buttons are there as "Update" and "Cancel" and want to change the text Update to "Save".I am Crating my application in MVC. My Code goes as Follows:
@(Html.Kendo().Grid<Invoice.Models.ViewModels.DossierViewModel>()
.Name("Dossier")
.Columns(columns =>
{
columns.Bound(p => p.DisplayID).ClientTemplate("<a href=" + @Url.Content("~/Document/DocumentList/#= data.DossierID#") + ">#=data.DisplayID#</a>").Title("Dossier").Width(80);
columns.Bound(p => p.CustomerName).Title("Customer").Width(150);
columns.Bound(p => p.InvoiceNumber).Title("INV no.").Width(100).ClientTemplate("<a href=" + @Url.Content("~/Home/PrintInvoice/#= data.InvoiceNumber#") + " target='_blank'>#=data.InvoiceNumber#</a>");
columns.Bound(p => p.Status).ClientTemplate("#=data.Status#");
})
.ToolBar(toolbar =>
{
toolbar.Create().Text("Add New Dossier");
toolbar.Custom().Text("Search").Action("AdvanceSearch", "Dossier");
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.Editable(ed => ed.Mode(GridEditMode.PopUp).TemplateName("New_Dossier")) //Having Different Template for New Dossier
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(15)
.Model(model => { model.Id(p => p.DossierID); })
.Read(read => read.Action("Dossier_Read", "Dossier"))
.Create(create => create.Action("Dossier_Create", "Dossier", new { @CompanyID = ViewBag.CompanyID }))
)
)
Here as you Can see I am using my Own Template "New_Dossier" for Window Popup and my New_Dossier page looks like:
<div class="form-group">
<div class="control-group">
<label class="control-label">Name</label>
<div class="controls">
@(Html.Kendo().AutoComplete()
.Name("Customers")
.DataTextField("CustomerShortName")
.Filter("contains")
.MinLength(3)
.Events(events => events.Select("CustomerSelect"))
.HtmlAttributes(new { style = "width:250px" })
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetCustomers", "GetData");
//.Data("onAdditionalData");
})
.ServerFiltering(true);
})
)
</div>
</div>
</div>
Please Suggest me on this.
Upvotes: 1
Views: 3476
Reputation: 61
In grid definition:
.Events(events => events.Edit("insertPopupCaption"))
In JavaScript:
function insertPopupCaption(e) {
$('.k-window-title').text("[PopupEditCaption]");
$('.k-grid-update').text("[UpdateButtonText]");
$('.k-grid-cancel').text("[CancelButtonText]");
}
This way, button icons are replaced too - if this is not intended, adjust JavaScript.
Upvotes: 6