I am trying to implement a custom tool in the Kendo Editor, following demo/doc implementation and always getting a typeError of some form whenever the custom tool uses a kendo template. For example:
@(Html.Kendo().Editor()
.Name("editor")
.Tools(tools => {
tools
.Clear()
.Bold()
.Italic()
.CustomTemplate(temp => temp.Template(
Html.Kendo().DropDownList()
.Name("ddl1")
.DataTextField("Text")
.DataValueField("Value")
.BindTo(new List<object>
{
new { Text = "text 1", Value = "Value 1" },
new { Text = "text 2", Value = "Value 2" },
new { Text = "text 3", Value = "Value 3" },
new { Text = "text 4", Value = "Value 4" }
})
.ToClientTemplate()
.ToHtmlString()
));
})
)
In this case the error is as follows:
Uncaught TypeError: Cannot read properties of null (reading 'length')
We are using KendoEditor in our MVC application. When assigend HTML to it it is auto formatting it. E.g.
<p style="font-size:13.3333px;"><span style="font-family:Verdana, Geneva, sans-serif;font-size:14pt;">Dear ABC</></></></span></p><p style="font-size:13.3333px;"><span style="font-family:Verdana, Geneva, sans-serif;font-size:14pt;">We have received your details: </span><span style="color:#ffffff;"><span id="spa123"><span> Certificates</span><table class="tbl" border="1" cellpadding="1" cellspacing="0" style="width:100%;font-family:inherit;font-size:inherit;color:inherit;" ><tr style="font-weight:bold;"><td style="text-align: right">Id</td><td style="text-align: left">name</td><td style="text-align: left">Amount</td><td style="text-align: left">Other</td><td style="text-align: left">Comments</td></tr><tr><td style="text-align: right;">1</td><td style="text-align: left;"></td><td style="text-align: left;"></td><td style="text-align: left;"></td><td style="text-align: left;"></td></tr></table></span></span> <span style="background-color:#ffffff;color:#ffffff;"></span></p>
changing to
<p style="font-size:13.3333px;"><span style="font-family:Verdana, Geneva, sans-serif;font-size:14pt;">Dear ABC</span></p>
<p style="font-size:13.3333px;"><span style="font-family:Verdana, Geneva, sans-serif;font-size:14pt;">We have received your details: </span><span style="color:#ffffff;"><span id="spa123"><span>Certificates</span></span></span></p>
<table class="tbl k-table" border="1" cellpadding="1" cellspacing="0" style="width:100%;font-family:inherit;font-size:inherit;color:inherit;"><tbody><tr style="font-weight:bold;"><td style="text-align:right;">Id</td>
<td style="text-align:left;">name</td>
<td style="text-align:left;">Amount</td>
<td style="text-align:left;">Other</td>
<td style="text-align:left;">Comments</td>
</tr>
<tr><td style="text-align:right;">1</td>
<td style="text-align:left;"> </td>
<td style="text-align:left;"> </td>
<td style="text-align:left;"> </td>
<td style="text-align:left;"> </td>
</tr>
</tbody></table>
<span style="background-color:#ffffff;color:#ffffff;"></span><p> </p>
Here <span> and <P> tags automatically getting closed before table. while extected is all should be in span with <span style="color:#ffffff;">.
Not able to trace why it is happning.
i.Add()
.Id(Id.ToString())
.Name(Id.ToString())
.Title(Name.ToString())
.Field(Id.ToString())
.Label(l => l.Text(Lab + ":"))
.Editor(e =>
{
e.NumericTextBox<Decimal>()
.Format("c")
.Value(System.Convert.ToDecimal(Answer));
});
Posted above is an item on a form unfortunately the Value property doesn't display anything nor does hard coding a number into Value property. However, when I place the same variable into the placeholder property, it does seem to display what its supposed to. Is there a reported bug for why this is happening or perhaps a work around to assist this.
Thank you in advance for your assistance
EditorImageBrowserController in Q1 2024 release of Kendo UI, we're seeking guidance on the best approach to migrate our existing application. Could you please provide specific recommendations on how to achieve image management (read, upload and etc) in image browser (from Editor) using the latest Kendo UI components and best practices?
@(Html.Kendo().Grid<RVNLMIS.Models.ListMasterBOQResourceCalc>()
.Name("ResourceTypeGrid")
.Columns(columns =>
{
// Resource Type column
columns.Bound(c => c.RsrcType)
.Title("Resource Type")
.ClientTemplate("#= RsrcType ? RsrcType.ResourceTypeName : '' #")
.EditorTemplateName("ClientResource")
.Sortable(false)
.HtmlAttributes(new { style = "text-align:left" })
.HeaderHtmlAttributes(new { style = "text-align:left" })
.Width(120)
;
// Resource Name column
columns.Bound(c => c.drpResource)
.Title("Resource")
.ClientTemplate("#= drpResource ? drpResource.ResourceName : ''#")
.EditorTemplateName("ClientSubResources")
.Sortable(false)
.HtmlAttributes(new { style = "text-align:left" })
.HeaderHtmlAttributes(new { style = "text-align:left" })
.Width(120);
// Quantity column
columns.Bound(c => c.rsrcQty)
.Title("Quantity")
.HtmlAttributes(new { style = "text-align:right" })
.HeaderHtmlAttributes(new { style = "text-align:right" })
.Width(70)
.Format("{0:N2}");
// Wastage Percentage column
columns.Bound(c => c.wastagePct)
.Title("Wastage %")
.HtmlAttributes(new { style = "text-align:right" })
.HeaderHtmlAttributes(new { style = "text-align:right" })
.Width(60);
// Total Quantity column
columns.Bound(c => c.TotalQty)
.Title("Total Qty")
.HtmlAttributes(new { style = "text-align:right" })
.HeaderHtmlAttributes(new { style = "text-align:right" })
.Width(80)
.Format("{0:N2}");
// Unit column
columns.Bound(c => c.Unit)
.Title("Unit")
.HtmlAttributes(new { style = "text-align:left" })
.HeaderHtmlAttributes(new { style = "text-align:left" })
.Width(60);
// Base Rate column
columns.Bound(c => c.BaseRate)
.Title("Base Rate")
.HtmlAttributes(new { style = "text-align:right" })
.HeaderHtmlAttributes(new { style = "text-align:right" })
.Width(80)
.Format("{0:N2}");
// Total Rate column
columns.Bound(c => c.TotalRate)
.Title("Resource Amount")
.HtmlAttributes(new { style = "text-align:right" })
.HeaderHtmlAttributes(new { style = "text-align:right" })
.Width(100)
.Format("{0:N2}");
columns.Command(command => command.Destroy()).Width(150);
})
.ToolBar(t =>
{
t.Create().HtmlAttributes(new { style = "float:right; margin: 5px;" });
t.Save().HtmlAttributes(new { style = "float:right; margin: 5px;" });
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Pageable() // Pagination enabled
.Sortable() // Sorting enabled
.Scrollable() // Scrollable grid
.HtmlAttributes(new { style = "height:500px;" })
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true) // Batch editing
.ServerOperation(false) // Client-side operations
.Model(model =>
{
model.Id(p => p.AutoID); // Set primary key
model.Field(p => p.AutoID).Editable(false); // Disable editing for AutoID
model.Field(p => p.RsrcType).DefaultValue(
ViewData["defaultResourceType"] as RVNLMIS.Controllers.Sub_BOQController.ResourceTypeModel);
model.Field(p => p.drpResource).DefaultValue(new RVNLMIS.Controllers.Sub_BOQController.DrpResourceModel
{
ResourceName = "Select Resource",
ResourceID = 0
});
})
.PageSize(20) // Set page size
.Read(read => read.Action("GetBOQResource_Details", "Sub_BOQ").Data("getBOQId"))
.Create(create => create.Action("EditingCustom_Create", "Sub_BOQ"))
.Update(update => update.Action("EditingCustom_Update", "Sub_BOQ"))
.Destroy(destroy => destroy.Action("EditingCustom_Destroy", "Sub_BOQ"))
)
)
Above is grid code , the tool bar is not showing at the top of the grid .
It should show like below example.
I have a grid popup edit template that includes a Kendo dropdown. I need to pass a model property value as the parameter to the Read() method of the dropdown. But the model is null when the Read() method gets called. So the value is always 0.
I've defined the Field in the parent grid. I even added it as a column too. Model.ProductId is always 0.
How do I pass a value from the popup editor model to the controller for the dropdown?
@(Html.Kendo().DropDownList() .Name("WarehouseId") .OptionLabel("Select a warehouse...") .HtmlAttributes(new { style = "width: 100%" }) .DataTextField("Text") .DataValueField("Value") .Value("-1") .DataSource(source => { source.Read(read => { read.Action("Inventory_Warehouse_Read", "Purchasing", new { productId = @Model.ProductId}); }); }) .Height(400) )
public ActionResult EditActivity(EditActivity model) { var activity = _uow.Activities.GetById(model.ActivityId); activity.Phone = model.Phone; activity.Fax = model.Fax; activity.LastUpdateDate = DateTime.Now; activity.LastUpdatedBy = _sessionHandler.UserId; if (ModelState.IsValid) { try { _uow.Activities.Update(activity); _uow.Commit(); TempData["SaveResultMessage"] = $"Changes to Activity : {activity.ActivityName} have been saved"; } catch { ModelState.AddModelError("Save", "Error occurred on save."); } return RedirectToAction("Index", "DepartmentActivity", new { id = activity.DepartmentId, }); } return View(model);
In rich text editor does kendo support the layout column selection same as we have option in word like this
does kendo mvc rich text editor support that if yes please let us know how ?
I have review this form discussions but cannot get this working.
How to add a delete button to editor template Grid Popup? in Kendo UI for jQuery | Telerik Forums
How can I add an additional update button inside of my grid popup editor template? I have the exact same requirements as discussed in
Add extra button to Grid popup editor template in UI for ASP.NET MVC | Telerik Forums
Perhaps little different as I am using a custom popup editor template called RecordEdit.cshtml as outlined in ASP.NET MVC Data Grid Component Use Custom Popup Editors - Telerik UI for ASP.NET MVC@(Html.Kendo().Grid//....
//....
.Events(ev=>ev.Edit("onEdit"))
.Editable
(
editable => editable.Mode(GridEditMode.PopUp)
.TemplateName("RecordEdit")
.Window(e => e.Width(1400).Height(1200))
)
)
function onEdit() {
$('<a class="k-button k-button-icontext k-grid-delete" href="\\#"><span class="k-icon k-delete"></span>Delete</a>').insertAfter(".k-grid-cancel");
}