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 587
1 Sergey Alexandrovich Kryukov 479
2 Maciej Los 305
3 Mathew Soji 195
4 BillWoodruff 170
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,777
2 DamithSL 5,461
3 Manas Bhardwaj 4,916
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.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