mvc3返回部分视图网格. [英] mvc3 returning partial view grid.

查看:92
本文介绍了mvc3返回部分视图网格.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我已经更新了网格,并且如果我返回partialview("/grid",lstNames).然后在我的屏幕上只显示网格,而我在同一页面上也有用户名和密码控件.

如何解决此问题,请帮助我,并提前致谢.

Pavan.

Hi All,

I have updated the grid and if i return partialview("/grid",lstNames). Then in my screen only grid is displaying, whereas I have Username and password controls also in the same page.

How to solve this please help me out and thanks in advance.

Pavan.

推荐答案

您正在调用的方法的签名是什么,以及如何调用它?

如果要链接到该方法(而不是通过Ajax请求),则浏览器将被重定向到返回的内容.同样,从请求作为URL的操作方法返回部分视图将意味着您的页面正在跳过_layout呈现.

更新网格时,是否表示您正在发布值?提交表格?如果执行了表单操作,则浏览器只是想将用户带到该页面.相反,您需要将表单值捆绑在一起(为此,JSON应该很容易),然后将这些值发布到您的操作方法中.这将允许您返回部分内容并将其注入/替换在页面中.

希望对您有所帮助.

干杯.
What is the signature of the method you are calling, and how are you invoking it?

If you are linking to the method (rather than requesting it via Ajax) then the browser will be redirected to the returned content. Also, returning a partial view from an action method that is requested as the URL will mean that your page is skipping the _layout rendering.

When you update the grid, do you mean you''re POSTing values? Submitting a form? If the form action is executed, the browser''s just going to want to take the user to that page. You''ll need to instead bundle the form values up (JSON should be easy for this) and then POST the values to your action method. This will allow you to return the partial and inject/replace it in your page.

Hope this helps some.

Cheers.


这篇关于mvc3返回部分视图网格.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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