I have a grid set when I'm pulling one of the fields in using an inline drop down list.
I can retrieve the values I need from the dropdown list data item, and i can set the values in the grid's edit row using the dropdown list.
The following code works fine as long as A, B, C, and D are editable... BUT... these values should not be editable. The values in these cells should be driven strictly by the values of the drop down list.
function ddl_OnSelect(e)
{
var DDLdataItem = this.dataItem(e.item);
var A = DDLdataItem.A;
var B = DDLdataItem.B;
var C = DDLdataItem.C;
var D = DDLdataItem.D;
var grid = $('#grd').data('kendoGrid');
var editRow = grid.dataItem("tr.k-grid-edit-row");
editRow.set("A", DDLdataItem.A);
editRow.set("B", DDLdataItem.B);
editRow.set("C", DDLdataItem.C);
editRow.set("D", DDLdataItem.D);
}
I feel like I should be able to display the values in a template column, but I'm not finding any good documentation on column.template, and when I do something like this it just gives me an empty column.
columns.Template(
@<text>
<input type="text" name="A" value="@item.A" readonly />
</text>
).Title("A");
UPDATE
Ok.... so what I did to "fix" the issue was...
First I created a new editortemplate called ReadOnlyCurrency and placed it in the shared EditorTemplates.
Then for each of the 3 currency columns that this applies to I added the editor template name property.
.EditorTemplateName("ReadOnlyCurrency")
I then copied the contents of the currency editor template and pasted it into the readonlycurrency template
I turned off the spinners, made it readonly, and made it enabled false.
@model decimal?
@(Html.Kendo().CurrencyTextBoxFor(m => m)
.HtmlAttributes(new { style = "width:100%;", @readonly = "readonly" })
.Enable(false)
.Min(0)
.Spinners(false)
)
This is sufficient for what I'm trying to do, but I'm not going to mark this as the answer.
I would much rather have a label that is formatted to currency... but I'm having problems with the way the editortemplate passes in the model.