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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:37:25+00:00 2026-05-25T21:37:25+00:00

how can i Pass multiple model to controller and bind the data to viewpage

  • 0

how can i Pass multiple model to controller and bind the data to viewpage

i have list page in that page contains two tabs, one for active list and another one In active list.

how can i create a model and bind the data to viewpage.

how can i bind the data to view page, i used strong typed model

public class EventInfo  
    {

        public string SUBSITE { get; set; }
        public string TITLE { get; set; }
------
}
public class MyViewModel
{
    public IEnumerable<SomeViewModel> Active { get; set; }
    public IEnumerable<SomeViewModel> InActive { get; set; }
}



var model = new MyViewModel
            {
                Active = EventModel.EventList(ids, "", "", "", "", "", "", "", "1", "").ToList(),
                InActive = EventModel.EventList(ids, "", "", "", "", "", "", "", "1", "1").ToList()
            };

this is my view page code

<% foreach (var model in Model)
   { %>
     <tr>
       <td>
          <%= Html.ActionLink(model.TITLE, "Detail", new { id = model.EVENT_ID })%>
        </td>

I got an error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS1061: 'System.Collections.Generic.IEnumerable<EventListing.Models.MyViewModel>' does not contain a definition for 'Active' and no extension method 'Active' accepting a first argument of type 'System.Collections.Generic.IEnumerable<EventListing.Models.MyViewModel>' could be found (are you missing a using directive or an assembly reference?)

Source Error:



Line 221:                    </thead>
Line 222:                    <tbody>
Line 223:                        <% foreach (var model in Model.Active)
Line 224:                           { %>
Line 225:                        <tr>
  • 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-25T21:37:26+00:00Added an answer on May 25, 2026 at 9:37 pm

    Your ViewPage code does not match up with the error message you posted.

    The ViewPage code shows that the Model you’re passing is a collection of MyViewModel that you’re looping through to display links.

    The error message says that you’re only passing a single MyViewModel and you want to loop through the Active collection.

    Change your ViewPage so you’re using

    @model MyViewModel
    

    instead of

    @model IEnumerable<MyVieWModel>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Store Model that can have multiple products. Each product has a
Is there any way that I can pass arguments in selector? example: I have
I have a multiple ModelForm classes that each represent a different Model. I would
I have a view that is outputting a list of questions(yesno and multiple choice).
If I have a data/web service that multiple view models need access to what
When I submit a form in HTML, I can pass a parameter multiple times,
I know that I can pass a string as the second parameter to the
I was wondering how I can pass either an ArrayList, List <int > or
If I have a auto_ptr I can pass it for a reference?Like: auto_ptr<MyClass>Class(new MyClass);
I know from here that I can pass an ignore option in the jQuery.validate

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.