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 110011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:09:35+00:00 2026-05-11T02:09:35+00:00

I have the following code in my controller: public ActionResult Details(int id) { var

  • 0

I have the following code in my controller:

    public ActionResult Details(int id)     {         var dataContext = new BuffetSuppliersDBDataContext();         var supplier = (from m in dataContext.BO_Suppliers                          where m.SupplierID == id                         select m).FirstOrDefault();          ViewData.Model = supplier;          return View();     } 

This renders a view which contains the properties returned from the linq to sql query. What I need to do now is add another query which will return x amount of ratings for each supplier, i will then loop through the records in the view and display the ratings.

How can I push the results of my ratings query into the view along with what is already there?

  • 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. 2026-05-11T02:09:36+00:00Added an answer on May 11, 2026 at 2:09 am

    Your best option would to be create a class that you can pass into your view.

    public class SupplierDetail {     public Supplier { get; set; }     public SupplierRating { get; set; } }  public class SupplierDetailViewData {     public IEnumerable<SupplierDetail> SupplierDetails { get; set; } } 

    Then in your controller action use a join and select a new SupplierDetail class in the LINQ query. After that you can create a strongly-typed view by using the code-behind and changing it to this…

    public partial class Details : ViewPage<SupplierDetailViewData> { } 

    After that, in your view — ViewData.Model will be SupplierDetailViewData. Of course the second part is optional but it does make for better compile-time validation.

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

Sidebar

Related Questions

I have something similar to the following method: public ActionResult Details(int id) { var
I have the following code in my controller called UserController : public ActionResult Details(string
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have the following code in my Simulacion controller: [Authorize] public ActionResult Create() {
i'm new to routing in aspnet mvc.. i have following code: Action Controller public
Inside my controller's action I have the following code: public ActionResult GridAction(string id) {
I have the following code: $bind = new COM(LDAP://CN=GroupName,OU=Groups,OU=Division,DC=company,DC=local); When I execute it from
Suppose you have the following controller action [HttpPost] public ActionResult Save( CustomerModel model )
I have the following code public class BaseController : Controller { SqlConnection con; DataSet
I have the following code: SELECT <column>, count(*) FROM <table> GROUP BY <column> HAVING

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.