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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:59:50+00:00 2026-06-15T07:59:50+00:00

This is the view: @model tgpwebged.Models.sistema_DocType … this model is an entity used with

  • 0

This is the view:

@model tgpwebged.Models.sistema_DocType
 ...

this model is an entity used with textBoxFor and others html helpers

This is the controller.

public ActionResult AdminSettingAddTipo()
{
    IEnumerable<string> indices;

    using (tgpwebgedEntities context = new tgpwebgedEntities())
    {
        var obj = from u in context.sistema_Indexes select u.idName;
         indices = obj.ToList();
    }

    return PartialView(indices);
}

I have all I need here, I am using a model to create with the view so I am not allowed to send ´indices´ as a model because it´s not allowed to have 2 models in one view.

I don´t want to use ´Tupe´ now a parent view. I just want to know how is the best way to send my IEnumerable to the view.

I was thinking of ViewBag for the last option but I am avoiding ViewBag.

thanks

  • 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-15T07:59:51+00:00Added an answer on June 15, 2026 at 7:59 am

    ViewBag is not a good choice. Create ViewModel using your list and your current Model:

        public class YourViewModel
        {
    
            public sistema_DocType Type { get; set; }
            public IEnumerable<string> Indices {get;set;}
        }
    

    Hope,it will help.

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

Sidebar

Related Questions

I have this view : @model IEnumerable<sn.Models.Order> <h2> **Name of Recipients** </h2> <p> @Html.ActionLink(Create
I have this view @model IEnumerable<ViewModelRound2> ... <snip> ... @{ using (Html.BeginForm(new { round1Ring3Bids
I have a view model that looks like this public class ViewModelRound2 { public
Let's say I have this view model: public class MyModel { [Range(0, 999, ErrorMessage
I am using this view model: public class CaseComplaintsViewModel { public int CasesID {
In the world of MVC I have this view model... public class MyViewModel{ [Required]
Suppose I have this View Model: public class CreateGameViewModel { [Required] public string SideA
I'm new to MVC Razor. I have this view: @model SuburbanCustPortal.Models.CustomerModel @{ ViewBag.Title =
I have this view model: public class BankAccountViewModel : IValidator<BankAccountViewModel> { public BankAccount BankAccount
I have a model for a view. This view contains a an @Html.DropDownList whose

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.