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

  • SEARCH
  • Home
  • 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 8085211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:02:39+00:00 2026-06-05T18:02:39+00:00

My application uses asp.net 4, C# and Entity Framework. My database contains a table

  • 0

My application uses asp.net 4, C# and Entity Framework. My database contains a table Companies which has many Locations, which in turn has many Devices. A Company is keyed to the aspnet_user which is currently logged in.

I use grid views to display and edit the Locations and Devices for a single Company. This is easily achieved for the Locations as they have a direct link to a Company…

LocationListEntityDataSource.AutoGenerateWhereClause = true;
LocationListEntityDataSource.WhereParameters.Clear();
LocationListEntityDataSource.WhereParameters.Add("CompanyGuid", System.Data.DbType.Guid, Tools.Tools.getCompanyGuidString());

However I can not work out how to filter the Devices by Company as they only have a link to a Location. I had hope to use something similar to the following, but I get an exception stating that Location.CompanyGuid could not be found…

DeviceListEntityDataSource.AutoGenerateWhereClause = true;
DeviceListEntityDataSource.WhereParameters.Clear();
DeviceListEntityDataSource.WhereParameters.Add("Location.CompanyGuid", System.Data.DbType.Guid, Tools.Tools.getCompanyGuidString());

Any ideas on how this can be achieved?

  • 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-06-05T18:02:41+00:00Added an answer on June 5, 2026 at 6:02 pm

    Consider Company to have one to many relationship with Locations as well as Devices.

    When you put a virtual property of ICollection<Device> Devices; to the Company class. This will be just a navigation property. This will not create any column in company table for Devices. Then you have virtual property Company comapany and FK int CompanyId in the Device model. This will only add one field to Device table which is not big wastage of space.

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

Sidebar

Related Questions

My ASP.NET MVC 2 application uses Entity Framework 4.0 for the data model. Following
I have an ASP.NET MVC 3 (using Entity Framework 4.2) application that uses transactions
I have an asp.net mvc application, which uses the default user database. It all
I have built an ASP.NET MVC web application that uses Entity Framework. To provide
I'm trying to design an entity model for an application that uses ASP.Net membership
I'm creating an ASP.NET application which uses Facebook Connect and fbml tags. It also
We are developing an ASP.NET MVC Application that currently uses it's own database ApplicationData
I'm writing an application which uses ASP.NET MVC with JSON.NET as the server, sending
I've created a custom WSS 3.0 application which uses ASP.NET for AJAX The problem
I have an ASP.NET 3.5 application (on IIS 6.0) which uses ASP.NET forms authentication.

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.