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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:38:20+00:00 2026-05-27T12:38:20+00:00

I have been developing an application that uses Models that are based on a

  • 0

I have been developing an application that uses Models that are based on a single USP/dbml and using ViewBags to populate the look up lists for data entry and edit views. This has been ok until I start to implement business logic. The Dropdownlists because they are done with ViewBag.llkup aren’t available in the Script functions unless explictly passed to the function. I could create a single model that had multiple USP in it. I was wondering what is considered best practice concerning this issue.
Thanks
Bruce
I have the following code in a controller:

    using (var dc = new usp_TM_Select_ShortNameDataContext())
    {
        String[] s = this.User.Identity.Name.Split('\\');
        string[] s2 = s[1].Split('.');
        string a = s2[0] + '.' + s2[1];
        ViewBag.Message = a.ToString();
        ViewBag.DetailsList = new SelectList((System.Collections.IEnumerable)dc.usp_TM_Select_ShortName().ToList(), "short_title", "short_title");
        var poc = new usp_ARD_Select_POCDataContext();
        return View(poc.usp_ARD_Select_POC().Single());
    }

Both are strongly typed views but how do I return both if they are in a single model to the view so that they can be used (accessed)?
I have more complex examples where I have a Single record returned with multiple lookups. I am currently doing this with ViewBag and would like to use ViewModels.
Thanks
Bruce

  • 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-27T12:38:21+00:00Added an answer on May 27, 2026 at 12:38 pm

    Having the view strongly typed to a ViewModel would be my choice.

    You can see examples here:

    http://www.bidn.com/blogs/mbrown/development/2139/mvc-3-view-models

    When do I use View Models, Partials, Templates and handle child bindings with MVC 3

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

Sidebar

Related Questions

I have been developing a small Java utility that uses two frameworks: Encog and
I have been developing a Java application using J2EE and a Derby database. My
I have been developing many application and have been into confusion about using dataset.
I have been developing an application in asp.net mvc3. We have used models to
I have been developing an application that can publish content like some sort of
I have been developing an application for the last 12 months using VS2008, VB.NET(WPF)
I have an iPad application that I have been developing on simulator just fine
Right, I have been developing a application using the MVP framework as reccomended by
I have been developing an Android application and testing the orientation sensor using SensorSimulator
I've been developing an application that uses wxPython as the GUI librar, and py2exe

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.