Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MVC3
Hi,
 
I do not understand, why I am having error in this below code.
 
Can anyone please help for real quick. I am adding code and query window as well.
 
Html.EnableClientValidation();
 
   var grid = Html.DevExpress().GridView(settings =>
   {
       settings.Name = "gvIndices";
       settings.KeyFieldName = "Id";
       settings.SettingsBehavior.ColumnResizeMode = ColumnResizeMode.Control;
       settings.CallbackRouteValues = new { Controller = "Person", Action = "IndexPartial" };
       settings.SettingsEditing.AddNewRowRouteValues = new { Controller = "Person", Action = "InlineAddPartial" };
       settings.Width = Unit.Percentage(100);
       settings.SettingsEditing.Mode = GridViewEditingMode.EditFormAndDisplayRow;
       settings.SettingsBehavior.ConfirmDelete = true;
       settings.CommandColumn.Visible = true;
       settings.CommandColumn.DeleteButton.Visible = true;
 
       settings.CommandColumn.SetHeaderTemplateContent(c =>
       {
           Html.DevExpress().HyperLink(hyperLinkSettings =>
           {
               hyperLinkSettings.Name = "link_" + settings.Name;
               hyperLinkSettings.Properties.Text = "New";
               hyperLinkSettings.NavigateUrl = "javascript:void(0);";
               hyperLinkSettings.Properties.ClientSideEvents.Click = string.Format(@"function(s, e){{{0}.AddNewRow();}}", settings.Name);
           }).Render();
           ViewContext.Writer.Write("  ");
           Html.DevExpress().HyperLink(hyperLinkSettings =>
           {
               hyperLinkSettings.Name = "Pastelink_" + settings.Name;
               hyperLinkSettings.Properties.Text = "Paste";
               hyperLinkSettings.NavigateUrl = "javascript:void(0);";
               hyperLinkSettings.Properties.ClientSideEvents.Click = "function(s, e){OpenPopup(s, e);}";
           }).Render();
       });
 
       settings.Columns.Add("Id");
       settings.Columns.Add("name");
       settings.Columns.Add("city");
 
       settings.SettingsPager.Position = PagerPosition.TopAndBottom;
       settings.SettingsPager.FirstPageButton.Visible = true;
       settings.SettingsPager.LastPageButton.Visible = true;
       settings.SettingsPager.PageSizeItemSettings.Visible = true;
       settings.SettingsPager.PageSizeItemSettings.Items = new string[] { "10", "20", "50" };
   });
 
   if (ViewData["EditError"] != null)
   {
       grid.SetEditErrorText((string)ViewData["EditError"]);
   }
 
   grid.Bind(Model).GetHtml();
 

IT SHOWS ERROR IN THE BELOW LINE WITH ERROR FOR IQUERYABLE.
 
ERROR LINE : grid.Bind(Model).GetHtml();
 
ERROR DETAIL : Unable to obtain IQueryable instance from ''.'' or Selecting event
Posted 7-Dec-12 9:32am
Comments
Zoltán Zörgő at 7-Dec-12 15:51pm
   
Most likely your model is wrong.
1) How is your model declared in the view?
2) How do you call the view?
3) How exactly is populated the model object passed to the view?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 295
1 DamithSL 265
2 CPallini 235
3 Maciej Los 190
4 George Jonsson 170
0 OriginalGriff 5,415
1 DamithSL 4,422
2 Maciej Los 3,820
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,911


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 7 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100