Part 30- How to return multiple models to a view in asp.net mvc | Interview question

preview_player
Показать описание
OVERVIEW :
Here in this video you will come to know about , how can you return more than one model or multiple models to a view . Its very important question for the interview and everyone should know this.

SOCIAL :

Follow us on Twitter : @technotipsMVC

GET CODE HERE :

INTRODUCTION :
The concept behind returning multiple model in single view is that you can use the class name as property which can be defined in some other class or model. following are the steps to do that .

1. Create modelA, modelB, and modelC
2.Define property in model C which will be like following
public modelA myfirstModelProperty { get; set }
public modelB mySecondModelProperty { get; set }
3. Return modelC to view
4.Done

RECOMMENDATION:

TAGS :
mvc return more than one model view
return multiple model
login page bootstrap
create registration page
Partial view in mvc
html.RenderAction
how to create a - website
how to create bootstrap popup modal
asp. net mvc
model view controller
jquery-ajax Post
Рекомендации по теме
Комментарии
Автор

Can we reach 1000 likes on this video. Share this video among your friends and Give your suggestions on which topic I should make videos. Thanks

aapkanigam
Автор

Thank you very much..its important question of MVC.

devdattrai
Автор

thq for vedios, We r going to use ViewModels to achieve same.

rajeshyada
Автор

Nice tip, the other option would be... using viewbag for each model(a & b)

donaghyamachi
Автор

Your explaining is most beatifull.Thanks!

mehmetaltuntas
Автор

How can you hide the tope menu link while on registration or when your only general user?

IrizLegaspi
Автор

Thank you very much awesome keep it up

pankajgour
Автор

How to use @foreach from two models?
Example: we have two function

FunctionGetParamenter and FunctionSelectAll from SQL Server to display data into the only table

sadenlav
Автор

hello sir
i m facing error Under -- (m=> m.name)
error is--- "an expression tree may not contain a dynamic operation "


please help....

sanketdholu
Автор

Sir i got an error of- foreach statement cannot operate on variables of type "MyViewModel" because "MyViewModel" does not contain a public definition for 'GetEnumerator'... When i try to display single & List of data in same view...Please Help me...

vinayakjambhale
Автор

Oh, ok. So, basically use a global model that encapsulates the models you need for a page.
What I have been doing, basically.
Just checking it there was a better way but it's more of the same.

fabio.albuquerque
Автор

What is answer of questions please provide a summary in end

amamsharma
Автор

Ashish, This is great tutorial. and if i need to pull data from sql for Dropdownlist what should i do.

balasenk
Автор

Nice video sir, If i m insert data same multiple model then how it is possible ?

achalprajapati
Автор

Ashish how to apply required validation to the multiple model view

Yogeshghonate
Автор

sir how to achieve editable table with multiple rows and post the data of multiple rows to a multiple tables in SQL server using MVC

icccricket
Автор

can we use expandoobjects without creating separate viewmodel.

lifet
Автор

How to pass Data from one view to another View?

adishjain
visit shbcf.ru