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

Error in columns.ForeignKey

5 Answers 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gab
Top achievements
Rank 1
Gab asked on 02 Feb 2014, 08:34 AM
Hi, I have the following problem, and I do not know how to solve: 


Error de servidor en la aplicación '/'. El valor no puede ser nulo.
Nombre del parámetro: items Descripción: Excepción no controlada al ejecutar la solicitud Web actual. Revise el seguimiento de la pila para obtener más información acerca del error y dónde se originó en el código.

Detalles de la excepción: System.ArgumentNullException: El valor no puede ser nulo.
Nombre del parámetro: items

Error de código fuente:

Línea 37: columns.ForeignKey(pozos => pozos.IdCatPlataforma, (IEnumerable<KendoGridAjaxEditing.Models.CatPlataforma>)ViewData["CatPlataforma"], dataFieldValue: "Id", dataFieldText: "Nombre");
Línea 38: columns.Bound(pozos => pozos.Descripcion).Width(250);
Línea 39: columns.Command(commands =>
Archivo de origen: c:\Users\GMayaS\Documents\Visual Studio 2013\Projects\KendoGridAjaxEditing\KendoGridAjaxEditing\Views\Home\Index.cshtml    Línea: 37

Seguimiento de la pila:

[ArgumentNullException: El valor no puede ser nulo.
Nombre del parámetro: items]
System.Web.Mvc.MultiSelectList..ctor(IEnumerable items, String dataValueField, String dataTextField, IEnumerable selectedValues) +361238
System.Web.Mvc.SelectList..ctor(IEnumerable items, String dataValueField, String dataTextField) +19
Kendo.Mvc.UI.Fluent.GridColumnFactory`1.ForeignKey(Expression`1 expression, IEnumerable data, String dataFieldValue, String dataFieldText) +69
ASP._Page_Views_Home_Index_cshtml.<Execute>b__11(GridColumnFactory`1 columns) in c:\Users\GMayaS\Documents\Visual Studio 2013\Projects\KendoGridAjaxEditing\KendoGridAjaxEditing\Views\Home\Index.cshtml:37
Kendo.Mvc.UI.Fluent.GridBuilder`1.Columns(Action`1 configurator) +144
ASP._Page_Views_Home_Index_cshtml.Execute() in c:\Users\GMayaS\Documents\Visual Studio 2013\Projects\KendoGridAjaxEditing\KendoGridAjaxEditing\Views\Home\Index.cshtml:27
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +97
System.Web.WebPages.StartPage.RunPage() +17
System.Web.WebPages.StartPage.ExecutePageHierarchy() +62
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +76
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +260
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +295
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +23
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +21
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +89
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +102
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +43
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +57
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +47
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +47
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9514812
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Información de versión: Versión de Microsoft .NET Framework:4.0.30319; Versión ASP.NET:4.0.30319.18408             

5 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 05 Feb 2014, 07:19 AM
Hi Gab,

Please find the answer of your question below. Please note however that the official support language is English - that why I would ask you to provide the related information in this language for future support requests.

It seems that the collection provided to the ForeignKeyColumn is null - could you please confirm that the data is available n the "CatPlataforma" field of the ViewData? Also if possible provide runable example where the issue is reproduced in order to investigate further current behavior.

Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Gab
Top achievements
Rank 1
answered on 06 Feb 2014, 01:48 AM
Vladimir Iliev. 

You should be aware that in Mexico the official language is Spanish, if you send the error is because my Spanish was Spanish Explorer. 

I understand I do not understand your answer. 

You will have an example with a database in SQL Server 2008.
0
Vladimir Iliev
Telerik team
answered on 07 Feb 2014, 10:04 AM
Hi,

I will leave the thread open and wait for the sample project.

Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Gab
Top achievements
Rank 1
answered on 07 Feb 2014, 09:31 PM
The problem with columns.ForeignKey I resolved already, now the problem is that the query did not work for filling the Grid.
0
Gab
Top achievements
Rank 1
answered on 07 Feb 2014, 11:16 PM
thanks for your help, can resolve the problem.
Tags
Grid
Asked by
Gab
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Gab
Top achievements
Rank 1
Share this question
or