如何在View和Partial View asp.net MVC之间共享模型 [英] How do I share model between View and Partial View asp.net MVC
问题描述
Hello Everybody
我是ASP.NET MVC的新手,我想解释一下我的问题。我有一个名为BaseView的视图和一个名为GetDetails的局部视图,当用户点击一个实体时,例如:SalesDocument目的是查看其详细信息(SalesDocumentLines),该应用程序将显示详细信息部分视图(GetDetails)通过BaseView,但在这个视图中我想实现一些CRUD按钮(删除,更新,插入)而我看不到关于细节实体的模型,它可能看到模型属于局部视图从视图。
Hello Everybody
I'm new in ASP.NET MVC and I want to explain my issue. I have one view called: "BaseView" and one partial view called: "GetDetails", when the user makes click on one entity for example: SalesDocument with the purpose to see its details (SalesDocumentLines), the application is going to show the detail partial view (GetDetails) through "BaseView", but in this view I want to implement some CRUD buttons (delete, update, insert) and I can't see the model about details entity, its possible to see the model belongs a partial view from view.
推荐答案
您可以将模型传递给这样的视图:
@ {
Html.RenderPartial(" your view",your_model,ViewData);
}
You can pass your model to view like this :
@{
Html.RenderPartial("your view", your_model, ViewData);
}
这篇关于如何在View和Partial View asp.net MVC之间共享模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!