如何刷新局部视图而不MVC刷新整个页面

编程入门 行业动态 更新时间:2024-10-27 23:16:43
本文介绍了如何刷新局部视图而不MVC刷新整个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我M在我的应用程序中使用Ajax的Tab平板。共有4个标签左手边和右手边的局部视图。在这些选项卡中的余米显示了一些数据,并有每个选项卡上选择一个链接按钮。当我点击任何选择链接按钮我为填充一些信息的部分观点。发生这种情况时我的看法是完全地再次加载。A B C D

I m using a Ajax Tab panel in my application. There are 4 tabs on Left hand side and a partial view on right hand side. In each of these tab I m displaying some data and there is a select link button on each tab. when I click on any of the select link button I m filling the partial view with some information. When this happens my view is completly loaded again. A B C D

例如,这些都是标签。让我们假设我米选项卡上的B和现在当我点击选择链接按钮我的看法是完全地加载信息。但该选项卡松此时的焦点。我回来的默认值。所以我想在这个帮助1)要么我必须只刷新局部视图,而无需加载整个页面2)或我需要保持对点击选择链接按钮活动标签索引值请帮我解决这个问题并提供我的例子

eg these are the tabs. let us suppose that I m on tab B and now when I click on the select link button My view is completly loaded with information. but the tab loose the focus at this point. I comes back to the default value. so I want help on this 1) either I have to refresh only the partial view without loading the complete page 2) or I need to maintain active tab index value on click on select link button Please help me with this problem and provide me examples

推荐答案

的Jquery Tabs-加载内容只有当点击 下面是示例中的标签加载哪些内容动态阿贾克斯。这是PHP,你需要改变什么放在控制器/动作,而不是PHP页面的URL的。

Jquery Tabs- Load Contents only when clicked Here is the example which loading content of the tabs dynamically by Ajax. It is for PHP what you need to change is put controller/action instead of URL of the PHP page.

$.get("controller/action", {tab_clicked, "my_tab"}, tab_fetch_cb, "text/json/xml");

否则,而不是Ajax.ActionLink的

or else instead of Ajax.ActionLink

使用<一的onclick =LoadTab(@ item.ID)>项目@ item.ID< / A>  和jQuery功能更改选项卡并加载数据dyanamicaly

use <a onclick="LoadTab(@item.ID)">Item @item.ID</a> and jquery function to change the tab and load data dyanamicaly

function LoadTab(id){ //Change tab here Ex: $('#tabs').tabs('select', index); $.get('ajax/test.html', {Id, id},function(data) { $('#Partial_Controller_Name').html(data); }); }

更多推荐

如何刷新局部视图而不MVC刷新整个页面

本文发布于:2023-11-13 21:56:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585426.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:而不   视图   局部   页面   MVC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!