This question is locked. New answers and comments are not allowed.
Hi,
I am using a Grid and Inline Mode editing. I suddenly get an Argument exception "Value cannot be null or empty." when clicking on the link to edit a cell value. If I change to InForm or Popup mode everything works perfectly, It used to work 5 months ago and and I have not changed anything in the cshtml file since then. There might have been changes in the web.config. I can't see any changes in the model either and there are no null values there. I have tried to strip down the grid but I still get the error.
Index.cshtml:
...
@(Html.Telerik().Grid(Model.ParameterListProcurement)
.Name("ParameterGridProcurement")
.DataKeys(keys =>
{
keys.Add(c => c.Id).RouteKey("id");
}
)
.DataBinding(dataBinding => dataBinding.Server()
.Select("GridSelect", "Parameter", new { mode = GridEditMode.InLine, type = GridButtonType.Image, supplierid = Model.SupplierId })
.Update("Update", "Parameter", new { mode = GridEditMode.InLine, type = GridButtonType.Image, supplierid = Model.SupplierId }))
.Columns(columns =>
{
columns.Bound(p => p.Description).ReadOnly().Width(100).Template(
@<text>
@item.Description
</text>);
columns.Bound(p => p).Width(30).Title("Par").EditorTemplateName("Parameter")
.Template(
@<text>
@item.Value
</text>);
columns.Command(commands =>
{
commands.Edit().ButtonType(GridButtonType.Image);
}).Width(20).Title("");
})
.Editable(editing => editing.Mode(GridEditMode.InLine))
.Footer(false)
)
...
Editortemplate/Parameter.cshtml:
@model ProOpt.Library.Domain.Parameter
<input id="Value" name="Value" value="@Model.Value.ToString()" />
Here is the stack trace:
vid System.Web.Mvc.FormContext.GetValidationMetadataForField(String fieldName, Boolean createIfNotFound)
vid System.Web.Mvc.Html.ValidationExtensions.ApplyFieldValidationMetadata(HtmlHelper htmlHelper, ModelMetadata modelMetadata, String modelName)
vid System.Web.Mvc.Html.ValidationExtensions.ValidationMessageHelper(HtmlHelper htmlHelper, ModelMetadata modelMetadata, String expression, String validationMessage, IDictionary`2 htmlAttributes)
vid System.Web.Mvc.Html.ValidationExtensions.ValidationMessageFor[TModel,TProperty](HtmlHelper`1 htmlHelper, Expression`1 expression, String validationMessage, IDictionary`2 htmlAttributes)
vid System.Web.Mvc.Html.ValidationExtensions.ValidationMessageFor[TModel,TProperty](HtmlHelper`1 htmlHelper, Expression`1 expression)
vid Telerik.Web.Mvc.UI.Html.GridEditorForCellBuilder`2.AppendValidatorFor(HtmlHelper`1 htmlHelper, IHtmlNode container) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridEditorForCellBuilder.cs:rad 116
vid Telerik.Web.Mvc.UI.Html.GridEditorForCellBuilder`2.AppendValidator(IHtmlNode container, HtmlHelper`1 htmlHelper) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridEditorForCellBuilder.cs:rad 100
vid Telerik.Web.Mvc.UI.Html.GridEditorForCellBuilder`2.AppendCellContent(IHtmlNode td, Object dataItem) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridEditorForCellBuilder.cs:rad 53
vid Telerik.Web.Mvc.UI.Html.GridDataCellBuilderBase.CreateCell(Object dataItem) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridDataCellBuilderBase.cs:rad 38
vid Telerik.Web.Mvc.UI.Html.GridInLineEditRowBuilder.AppendEditor(IHtmlNode container) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridInLineEditRowBuilder.cs:rad 59
vid Telerik.Web.Mvc.UI.Html.GridInLineEditRowBuilder.CreateRow() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridInLineEditRowBuilder.cs:rad 43
vid Telerik.Web.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridRowBuilderDecoratorBase.cs:rad 39
vid Telerik.Web.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridRowBuilderDecoratorBase.cs:rad 39
vid Telerik.Web.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridRowBuilderDecoratorBase.cs:rad 39
vid Telerik.Web.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridRowBuilderDecoratorBase.cs:rad 39
vid Telerik.Web.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridRowBuilderDecoratorBase.cs:rad 39
vid Telerik.Web.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridRowBuilderDecoratorBase.cs:rad 39
vid Telerik.Web.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridRowBuilderDecoratorBase.cs:rad 39
vid Telerik.Web.Mvc.UI.Html.GridDataSectionBuilder.CreateBody(IEnumerable`1 rowBuilders) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridDataSectionBuilder.cs:rad 38
vid Telerik.Web.Mvc.UI.Html.GridDataSectionBuilder.CreateBody(GridRenderingData renderingData) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridDataSectionBuilder.cs:rad 29
vid Telerik.Web.Mvc.UI.Html.GridHtmlBuilder.CreateBody(GridRenderingData renderingData) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridHtmlBuilder.cs:rad 193
vid Telerik.Web.Mvc.UI.Html.GridHtmlBuilder.AppendData(IHtmlNode div, GridRenderingData renderingData) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridHtmlBuilder.cs:rad 68
vid Telerik.Web.Mvc.UI.Html.GridHtmlBuilder.CreateGrid(IDictionary`2 htmlAttributes, GridFunctionalData functionalData, GridRenderingData renderingData) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridHtmlBuilder.cs:rad 43
vid Telerik.Web.Mvc.UI.Grid`1.WriteHtml(HtmlTextWriter writer) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Grid.cs:rad 676
vid Telerik.Web.Mvc.UI.ViewComponentBase.ToHtmlString() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\ViewComponentBase.cs:rad 215
vid Telerik.Web.Mvc.UI.ViewComponentBuilderBase`2.ToHtmlString() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\ViewComponentBuilderBase.cs:rad 154
vid Telerik.Web.Mvc.{Dynamic}.GridBuilder`1\[\[ProOpt.Library.Domain.Parameter\, ProOpt.Library\, Version=1.0.0.0\, Culture=neutral\, PublicKeyToken=null\]\].IHtmlString.ToHtmlString()
vid System.Web.HttpUtility.HtmlEncode(Object value)
vid System.Web.WebPages.WebPageExecutingBase.WriteTo(TextWriter writer, Object content)
vid System.Web.WebPages.WebPageBase.Write(Object value)
vid ASP._Page_Views_parameter_Index_cshtml.Execute() i c:\Doc\Procurement Optimizer\Dev\ProOpt\ProOpt\Views\Parameter\Index.cshtml:rad 27
vid System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
vid System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
vid System.Web.WebPages.StartPage.RunPage()
vid System.Web.WebPages.StartPage.ExecutePageHierarchy()
vid System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
vid System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
vid System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
vid System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
vid System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
vid System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
vid System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
Regards
Ola Westerholm
I am using a Grid and Inline Mode editing. I suddenly get an Argument exception "Value cannot be null or empty." when clicking on the link to edit a cell value. If I change to InForm or Popup mode everything works perfectly, It used to work 5 months ago and and I have not changed anything in the cshtml file since then. There might have been changes in the web.config. I can't see any changes in the model either and there are no null values there. I have tried to strip down the grid but I still get the error.
Index.cshtml:
...
@(Html.Telerik().Grid(Model.ParameterListProcurement)
.Name("ParameterGridProcurement")
.DataKeys(keys =>
{
keys.Add(c => c.Id).RouteKey("id");
}
)
.DataBinding(dataBinding => dataBinding.Server()
.Select("GridSelect", "Parameter", new { mode = GridEditMode.InLine, type = GridButtonType.Image, supplierid = Model.SupplierId })
.Update("Update", "Parameter", new { mode = GridEditMode.InLine, type = GridButtonType.Image, supplierid = Model.SupplierId }))
.Columns(columns =>
{
columns.Bound(p => p.Description).ReadOnly().Width(100).Template(
@<text>
@item.Description
</text>);
columns.Bound(p => p).Width(30).Title("Par").EditorTemplateName("Parameter")
.Template(
@<text>
@item.Value
</text>);
columns.Command(commands =>
{
commands.Edit().ButtonType(GridButtonType.Image);
}).Width(20).Title("");
})
.Editable(editing => editing.Mode(GridEditMode.InLine))
.Footer(false)
)
Editortemplate/Parameter.cshtml:
@model ProOpt.Library.Domain.Parameter
<input id="Value" name="Value" value="@Model.Value.ToString()" />
Here is the stack trace:
vid System.Web.Mvc.FormContext.GetValidationMetadataForField(String fieldName, Boolean createIfNotFound)
vid System.Web.Mvc.Html.ValidationExtensions.ApplyFieldValidationMetadata(HtmlHelper htmlHelper, ModelMetadata modelMetadata, String modelName)
vid System.Web.Mvc.Html.ValidationExtensions.ValidationMessageHelper(HtmlHelper htmlHelper, ModelMetadata modelMetadata, String expression, String validationMessage, IDictionary`2 htmlAttributes)
vid System.Web.Mvc.Html.ValidationExtensions.ValidationMessageFor[TModel,TProperty](HtmlHelper`1 htmlHelper, Expression`1 expression, String validationMessage, IDictionary`2 htmlAttributes)
vid System.Web.Mvc.Html.ValidationExtensions.ValidationMessageFor[TModel,TProperty](HtmlHelper`1 htmlHelper, Expression`1 expression)
vid Telerik.Web.Mvc.UI.Html.GridEditorForCellBuilder`2.AppendValidatorFor(HtmlHelper`1 htmlHelper, IHtmlNode container) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridEditorForCellBuilder.cs:rad 116
vid Telerik.Web.Mvc.UI.Html.GridEditorForCellBuilder`2.AppendValidator(IHtmlNode container, HtmlHelper`1 htmlHelper) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridEditorForCellBuilder.cs:rad 100
vid Telerik.Web.Mvc.UI.Html.GridEditorForCellBuilder`2.AppendCellContent(IHtmlNode td, Object dataItem) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridEditorForCellBuilder.cs:rad 53
vid Telerik.Web.Mvc.UI.Html.GridDataCellBuilderBase.CreateCell(Object dataItem) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridDataCellBuilderBase.cs:rad 38
vid Telerik.Web.Mvc.UI.Html.GridInLineEditRowBuilder.AppendEditor(IHtmlNode container) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridInLineEditRowBuilder.cs:rad 59
vid Telerik.Web.Mvc.UI.Html.GridInLineEditRowBuilder.CreateRow() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridInLineEditRowBuilder.cs:rad 43
vid Telerik.Web.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridRowBuilderDecoratorBase.cs:rad 39
vid Telerik.Web.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridRowBuilderDecoratorBase.cs:rad 39
vid Telerik.Web.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridRowBuilderDecoratorBase.cs:rad 39
vid Telerik.Web.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridRowBuilderDecoratorBase.cs:rad 39
vid Telerik.Web.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridRowBuilderDecoratorBase.cs:rad 39
vid Telerik.Web.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridRowBuilderDecoratorBase.cs:rad 39
vid Telerik.Web.Mvc.UI.Html.GridRowBuilderDecoratorBase.CreateRow() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridRowBuilderDecoratorBase.cs:rad 39
vid Telerik.Web.Mvc.UI.Html.GridDataSectionBuilder.CreateBody(IEnumerable`1 rowBuilders) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridDataSectionBuilder.cs:rad 38
vid Telerik.Web.Mvc.UI.Html.GridDataSectionBuilder.CreateBody(GridRenderingData renderingData) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridDataSectionBuilder.cs:rad 29
vid Telerik.Web.Mvc.UI.Html.GridHtmlBuilder.CreateBody(GridRenderingData renderingData) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridHtmlBuilder.cs:rad 193
vid Telerik.Web.Mvc.UI.Html.GridHtmlBuilder.AppendData(IHtmlNode div, GridRenderingData renderingData) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridHtmlBuilder.cs:rad 68
vid Telerik.Web.Mvc.UI.Html.GridHtmlBuilder.CreateGrid(IDictionary`2 htmlAttributes, GridFunctionalData functionalData, GridRenderingData renderingData) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Html\GridHtmlBuilder.cs:rad 43
vid Telerik.Web.Mvc.UI.Grid`1.WriteHtml(HtmlTextWriter writer) i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\Grid\Grid.cs:rad 676
vid Telerik.Web.Mvc.UI.ViewComponentBase.ToHtmlString() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\ViewComponentBase.cs:rad 215
vid Telerik.Web.Mvc.UI.ViewComponentBuilderBase`2.ToHtmlString() i f:\108\Griffin\Current Full\Sources\Source\Telerik.Web.Mvc\UI\ViewComponentBuilderBase.cs:rad 154
vid Telerik.Web.Mvc.{Dynamic}.GridBuilder`1\[\[ProOpt.Library.Domain.Parameter\, ProOpt.Library\, Version=1.0.0.0\, Culture=neutral\, PublicKeyToken=null\]\].IHtmlString.ToHtmlString()
vid System.Web.HttpUtility.HtmlEncode(Object value)
vid System.Web.WebPages.WebPageExecutingBase.WriteTo(TextWriter writer, Object content)
vid System.Web.WebPages.WebPageBase.Write(Object value)
vid ASP._Page_Views_parameter_Index_cshtml.Execute() i c:\Doc\Procurement Optimizer\Dev\ProOpt\ProOpt\Views\Parameter\Index.cshtml:rad 27
vid System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
vid System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
vid System.Web.WebPages.StartPage.RunPage()
vid System.Web.WebPages.StartPage.ExecutePageHierarchy()
vid System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
vid System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
vid System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
vid System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
vid System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
vid System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
vid System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
Regards
Ola Westerholm