This is a migrated thread and some comments may be shown as answers.

How to show a cell value as text in an editor template

2 Answers 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Catherine
Top achievements
Rank 1
Catherine asked on 17 Jul 2018, 12:43 PM

Hi,

How would one show the value of a cell in a popup editor template without making it editable? In other words it's just text, not a disabled widgit.

Thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 19 Jul 2018, 03:52 PM
Hi Catherine,

To do this, you will need to create a custom template where you can define what you want shown. You can find attached below a sample based on our popup editing demo. Here's how to do that:

add the custom template to the Editable setting:

.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("CustomTemplateWithoutTb"))

then, create a view with something like this (the view name must match the string provided above, so this file must be called CustomTemplateWithoutTb, and it must be in the Views/Shared/EditorTemplates folder):

@model Kendo.Mvc.Examples.Models.ProductViewModelGridPopUp
 
<h3>Customized popup edit template</h3>
<br />
 
<div>
    @Html.LabelFor(model => model.ProductName)
</div>
<div>
    @Html.EditorFor(model => model.ProductName)
    @Html.ValidationMessageFor(model => model.ProductName)
</div>
 
<div>
    @Html.LabelFor(model => model.UnitPrice)
</div>
<div>
    ${UnitPrice}
</div>
 
<div>
    And you can add the other fields in the model in any mode you want - whether only rendered, or with an editor, or you can omit them.
</div>


Regards,
Marin Bratanov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Catherine
Top achievements
Rank 1
answered on 24 Jul 2018, 11:53 AM
Thanks Marin!
Tags
Grid
Asked by
Catherine
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Catherine
Top achievements
Rank 1
Share this question
or