Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
300
Getting Error: Parameter Count Mismatch
posted

I am binding grid in Razor View with an IQuerable data source of type "DataRow". I am getting the below specified error.

The Controller Code is :

<HttpPost()>
Function SearchResults(criteria As Infinity.ContactMgmt.Objects.ContactSearchCriteria) As ActionResult
Dim contactsearchResults = Infinity.ContactMgmt.Objects.ContactSearch.Fetch(criteria)
ViewData("SearchResults") = contactsearchResults.ContactSearchResults.AsQueryable
Return View()
End Function

View is:

@(Html.Infragistics().Grid(Of Infinity.ContactMgmt.Objects.ContactSearchData.ContactSearchResultsRow)(Model) _
.ID("grid1") _
.AutoGenerateColumns(False) _
.Columns(Function(columns)
columns.For(Function(c) c.ContactId).HeaderText("User Id").DataType("Int")
columns.For(Function(c) c.FileAsName).HeaderText("Name").DataType("String")
End Function) _
.Width("100%") _
.Height("350") _
.DataBind() _
.Render())

There are more than 20 columns in Model but we only want to display two columns.

Parameter count mismatch.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Reflection.TargetParameterCountException: Parameter count mismatch.

Source Error:

Line 5:          <legend>Contact Search Results</legend>
Line 6:          <p>
Line 7: @(Html.Infragistics().Grid(Of Infinity.ContactMgmt.Objects.ContactSearchData.ContactSearchResultsRow)(Model) _ Line 8:          .ID("grid1") _
Line 9:          .AutoGenerateColumns(False) _


Source File: D:\Test\MvcApplication1\MvcApplication1\Views\ContactSearch\ViewUserControlContactSearchResults.vbhtml Line: 7

Stack Trace:

[TargetParameterCountException: Parameter count mismatch.]
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +10280741
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +21
   System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) +61
   System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) +19
   Infragistics.Web.Mvc.GridModel.RenderHierarchicalQueryableRecursive(IQueryable queryable, WrappedGridResponse response, GridModel baseLayout) +556
   Infragistics.Web.Mvc.GridModel.RenderHierarchicalQueryableRecursive(IQueryable queryable, WrappedGridResponse response, GridModel baseLayout) +2060
   Infragistics.Web.Mvc.GridModel.RenderHierarchicalQueryable(IQueryable queryable) +359
   Infragistics.Web.Mvc.GridModel.DataBind() +355
   Infragistics.Web.Mvc.Grid`1.DataBind() +47
   ASP._Page_Views_ContactSearch_ViewUserControlContactSearchResults_vbhtml.Execute() in D:\Test\MvcApplication1\MvcApplication1\Views\ContactSearch\ViewUserControlContactSearchResults.vbhtml:7
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +81
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +222
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
   System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +276
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +108
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model) +32
   ASP._Page_Views_ContactSearch_SearchResults_vbhtml.Execute() in D:\Test\MvcApplication1\MvcApplication1\Views\ContactSearch\SearchResults.vbhtml:11
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +81
   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) +222
   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__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +23
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +324
   System.Web.Mvc.Controller.ExecuteCore() +106
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +91
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +34
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +19
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +48
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9478661
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +178



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17379            

Parents
  • 6279
    posted

    Hi,

    I haven't seen this error before so I'm afraid that I would have to ask you to provide us with a simple MVC sample project where the problem is reproducible.

    Feel free to set up just one or two rows of dummy data - me and the other forum members will need to inspect the way the grid is configured in the sample (sorry - the grid's code alone is insufficient in this case).

    Looking forward to your reply.

    Cheers,
    Borislav 

Reply Children