Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6713281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:21:39+00:00 2026-05-26T08:21:39+00:00

The grid in question is a simple list of locations, based on this collection:

  • 0

The grid in question is a simple list of locations, based on this collection:

public class Locations : BaseGrid
{
    public string zipCode { get; set;}
    public string city { get; set; }
    public string state { get; set; }
    public string timeZone { get; set;}
    public IPagination<Location> LocationList { get; set; }
}

and this entity:

[DataContract] // DataContract/DataMember used for JsonSerializer
public class Location
{
    public int ID { get; set; }
    public string Address;
    public string AlternateSupportingLocationNumber;
    public string City;
    public string CompanyName;
    [DataMember]
    public string CTU;
    public string Description;
    public double Distance;
    [DataMember]
    public string LocationNumber;
    public string ManagerName;
    public string PhoneNumber;
    public string State;
    public string SupportingLocationNumber;
    public string TimeZone;
    public string ZipCode;
    public bool IsInPhysicalInventory;
    public bool IsEslOwned;
}

The controller, which looks like this:

    public ActionResult NearestStoreCoverage( Locations locations )
    {
        if ( string.IsNullOrEmpty( locations.SortBy ) )
            locations.SortBy = "Distance";
        var list = _locationService.NearestStoreCoverage( locations, 50, ModelState );
        locations.LocationList = list.AsPagination(locations.Page ?? 1, list.Count);

        //go get locations that are close
        return View( "Details/NearestStoreCoverage", locations );

    }

Gets the view a list of Locations as a LocationList member of the Locations model, and populates this control:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Locations>" %>
<%@ Import Namespace="Models.Common"%>

<div class="detailSection" style="width:98%">
    <h1>Locations close to Zip Code -- <%=Model.zipCode %></h1>
    <div>
    <%= Html.Grid(Model.LocationList).Columns(column =>
         {
             column.For(x => x.LocationNumber)
                 .Named(Html.SortByLink("Location","LocationNumber"));
             column.For(x => x.Distance.ToString("N2")).Named(
                 Html.SortByLink("Distance", "Distance"));
             column.For(x => x.PhoneNumber.ToFormattedString()).
                 Named(Html.SortByLink("Phone Number",
                                       "PhoneNumber"));
             column.For(x => x.Address).Named(
                 Html.SortByLink("Address", "Address"));
             column.For(x => x.City).Named(
                 Html.SortByLink("City", "City"));
             column.For(x => x.State).Named(
                 Html.SortByLink("State", "State"));
             column.For(x => x.ZipCode).Named(
                 Html.SortByLink("ZipCode", "ZIpCode"));
         })
            .Attributes(style => "width:100%")
            .Attributes(id => "locationClosesttoZipGrid")
            .Empty("There are no locations close to this zipcode") %>
    <%= Html.Pager( Model.LocationList ).Link( page => Html.WritePageLink( page ) )%>
    </div>
</div>

Whren this is run, the runtime error is

System.ArgumentException was unhandled by user code
  Message=The property Models.Common.Location.LocationNumber could not be found.
  Source=System.Web.Mvc
  InnerException:

(I removed the stack trace for the client, it is boring anyway)

However, if you debug and look at the Model (this is from Html.Grid(Model.LocationList).Columns), you can clearly see that LocationNumber is populated:

A look at the Model in the debugger http://img839.imageshack.us/img839/6538/34gridresults.png

Think it can’t get stranger? If I comment out the reference to the LocationNumber, the debugger allows the Distance and Phone Number, and then fails again on Address (which is also clearly there).

I have tried a rebuild, and have F12ed all of the relevant symbols to make sure they go where I think they should go.

The debugger won’t let me look at x, which is a bummer. Any idea what could be wrong, or at least how to start looking?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:21:40+00:00Added an answer on May 26, 2026 at 8:21 am

    The troublesome properties are declared as fields.

    Apparently, the grid can handle properties and method calls: the fields which have method calls on them are the ones that are working. Looks like fields don’t work.

    (thanks to Craig Stuntz for pointing that out)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Alberto Santini's solution to this question to get a spiral grid reference
This time, my question is as simple as it sounds... how do you get
I have a simple question. Can a grid automatically resize the objects in it
,This question is likely subjective, but a lot of grid Javascript plugins have come
My question is simple.. I have a grid of images on the left, and
I hope this question takes a simple fix, and I am just missing something
I have this very simple XAML window: <Grid> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <ContentControl Content={Binding
This is probably a simple question, but it's driving me crazy! I have a
I am embarrassed to ask this simple question, but has been in kicking my
Simple question. Is there a function to get the current sort position of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.