我如何在一个控制器中使用两个动作返回一个主视图和另一个局部视图 [英] How can i use two action in one controller return one main view and onother partial view

查看:57
本文介绍了我如何在一个控制器中使用两个动作返回一个主视图和另一个局部视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要这个解决方案,只要有人可以做到

我有一个人表2列

ID名称

我有一个可以插入数据的创建视图和控制器操作.

显示所有数据的另一个视图(部分)和控制器操作showall.

当我插入新记录时,它将用新记录刷新我的部分视图

创建视图的样子

ID:3
姓名:iran

创建
ShowAll视图(部分视图,它将显示在创建"按钮下)

ID名称
1巴布
2萨米尔

插入ID 3之后,视图将如下所示:

ID名称
1巴布
2萨米尔
3 iran

Hi i need this solution if any one can do it

i have a person table 2 column

ID Name

i have one create view and controller action which insert data.

another view(partial) and controller action showall which show all data.

When i insert new record then it will refresh my partial view with new record

create view will look like

ID:3
Name:iran

Create
ShowAll view(partial. and it will show under create button)

ID Name
1 babu
2 samir

After insert id 3 then view will look like

ID Name
1 babu
2 samir
3 iran

推荐答案

这可能会有所帮助:
http://www .arrangeactassert.com/when-to-use-html-renderpartial-and-html-renderaction-in-asp-net-mvc-razor-views/ [
This could be helpfull:
http://www.arrangeactassert.com/when-to-use-html-renderpartial-and-html-renderaction-in-asp-net-mvc-razor-views/[^]

Just use
Html.RenderPartial



在您看来.



In your view.


这篇关于我如何在一个控制器中使用两个动作返回一个主视图和另一个局部视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆