---
title: "Two model type in one View"  
description: "Two model type in one View"  
author: "Anonymous User"  
published: 2014-11-03  
updated: 2014-11-04  
canonical: https://www.mindstick.com/forum/2501/two-model-type-in-one-view  
category: "asp.net"  
tags: ["c#", "asp.net mvc", "mvc4"]  
reading_time: 1 minute  

---

# Two model type in one View

I have a concern. I am populating a list from [controller](https://www.mindstick.com/blog/273/passing-values-from-controller-to-view-in-asp-dot-net-mvc) and showing a table. Now upon clicking of a [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net) in table row, i want to [populate](https://www.mindstick.com/blog/60/populate-records-in-second-listbox-according-to-the-selection-in-first-list-box) [modal popup](https://www.mindstick.com/articles/13038/crud-operation-searching-paging-in-mvc-with-modal-popup) for webform, which is a [partial view](https://www.mindstick.com/articles/1132/auto-refresh-partial-view-in-asp-dot-net-mvc). My [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) is, when i am using List Type model, i am not able to [convert](https://www.mindstick.com/forum/2093/configurationmanager-appsettings-convert-n-to-n-why) that model from list to [simple](https://yourviews.mindstick.com/story/1469/5-simple-ways-to-stay-fit-amp-healthy) as i have to pass simple model to [render](https://www.mindstick.com/interview/2205/why-we-need-a-separate-mobile-project-template-while-we-can-render-our-web-application-in-mobile-what-s-new-in-mvc-4-mobile-template) webform. My code is as below:

**Index.cshtml**

```
@model List<MvcApplication3.Models.ModelList>@foreach (var item in Model){     @Html.Parial("PartialView")}
```

**ModelList.cs****\**

```
public class ModelList{     public string Name { set; get; }     public string Product { set; get; }     public string Status { set; get; }     public string Password { set; get; }     public string Email { set; get; } }
```

**PartialView.cshtml**\

```
@model MvcApplication3.Models.ModelList@using (Html.BeginForm()){   ////}
```

**Controller**\

List<ModelList> objList = new List<ModelList>();

return View(objList);

How can i be able to use same model in both ways.\

## Replies

### Reply by Anonymous User

```
@foreach (var item in Model)
{
    // foreach is used to show data in table
    @Html.Partial("PartialView", item)
}
```

You need to tell it to use your item in the [partial](https://www.mindstick.com/blog/78/partial-class-in-dot-net)


---

Original Source: https://www.mindstick.com/forum/2501/two-model-type-in-one-view

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
