top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Is it possible use two ( multiple) models with a single view?

+2 votes
505 views

Is it possible use two ( multiple) models with a single view? If yes How?

posted Jun 4, 2014 by Khusboo

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

U cant use Multiple Model class for Single View. But alternatively we have one option.

For Example:

We have two Classes

public class ModelClass_1
{
public virtual string Name{get;set;}
public virtual int Age{get;set;}
public virtual ModelClass_2 {get;set;}
}

public class ModelClass_2
{
public virtual string Address{get;set;}
public virtual int Email{get;set;}
}

Razor Page:
@Html.TextBoxFor(m => m.ModelClass_2.Address)
@Html.TextBoxFor(m => m.ModelClass_2.Email)

Above Example will help u to access multiple model class over single view

answer Feb 25, 2015 by Balamurugan Kn
...