This is a strange problem. I have a grid (code below) that contains a templated column for a drop-down control. Whenever I run the site via an ip address I get the error. However, when I access the site with a proper domain (eg, rep.ngkflocal.com), it functions fine.
For instance, when accessed via the following URL: http://72.73.307.275/Plan/Edit/1342
The following error occurs: Uncaught ReferenceError: CapitalExpenditureType is not defined
However, when accessed like this via my local IIS web app: http://reppublish.ngkflocal.com/Plan/Edit/1342
I do not get the error, adding the row works fine.
Both point to the same files. Any ideas?
My Grid code follows:
@(Html.Kendo().Grid<Rep.Models.CapitalExpenditureViewModel>()
.Name("CEGrid")
.Columns(columns =>
{
columns.Bound(c => c.Description);
columns.Bound(c => c.CapitalExpenditureType).ClientTemplate("#=CapitalExpenditureType.Value#").Width(250);
columns.Bound(c => c.Amount);
columns.Bound(c => c.DateCostEstimated).Format("{0:dd/MM/yyyy}");
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(172);
})
.HtmlAttributes(new { style = "height: 400px;" })
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Sortable()
.Scrollable()
.Resizable(resize => resize.Columns(true))
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(datasource => datasource
.Ajax()
.Model(model =>
{
model.Id(p => p.CapitalExpenditureId);
model.Field(p => p.CapitalExpenditureType).DefaultValue(
ViewData["defaultcapitalExpenditure"] as Rep.Common.LookupItem);
})
.Create(update => update.Action("CapitalExpenditures_Create", "Plan", new { Id = Model.PlanId }))
.Read(read => read.Action("CapitalExpenditures_Read", "Plan", new { PlanId = Model.PlanId }))
.Update(update => update.Action("CapitalExpenditures_Update", "Plan"))
.Destroy(update => update.Action("CapitalExpenditures_Delete", "Plan"))
.PageSize(50)
)
)