在MVC中更新行 [英] Update Row in MVC

查看:47
本文介绍了在MVC中更新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用MVC框架.

我正在以表格式显示设置为记录.

当用户单击到特定行时,该行需要更新.

示例:
表格:
名称值Isactive
Linkbutton ABC测试True

Linkbutton ddc tes False

Linkbutton ddd ddd True

如果Isactive值= true,则用户单击Linkbutton时,需要将其更改为false,反之亦然.

请帮帮我..

Adance中的谢谢...

Hi All,

I am using MVC framework.

I am displaying set to records in Table format.

When User click to a Particular row that row need to updated.

Example:
Table:
Name value Isactive
Linkbutton ABC test True

Linkbutton ddc tes False

Linkbutton ddd ddd True

when user click the Linkbutton if Isactive value = true then it need to change false, viceversa.

Please help me..

Thanks In Adance...

推荐答案

我要这样做的是:

1)确保每一行都有唯一的ID.
2)单击时,使用行ID进行Ajax调用,以对状态进行切换的控制器动作(ToggleAction(int recordId,bool currentState).它将使调用进入您的存储库并记录从中传入的所需新状态电话.
3)该操作将返回部分视图,即新渲染的行.另外,它可以是一个简单的信号.
4)在Ajax调用成功的情况下,替换行的内容(或评估您的响应并更改单元格).

查看我的博客信息-我有一个关于MVC + jQuery的系列文章,这可能是您正在寻找的东西.

干杯.
What I would do is this:

1) Make sure each row has a unique ID.
2) When clicked, make an Ajax call with the ID of the row to a controller action that toggles the state (ToggleAction(int recordId, bool currentState). It would make the call into your repository and record the desired new state passed in from the call.
3) The action would return a partial view, which is the newly rendered row. Alternatively, it can be a simple signal.
4) On the success event of the Ajax call, replace the contents of the row (or evaluate your response and alter the cell).

Check my sig for my blog - I have a series started on MVC + jQuery, which may be what you''re looking for.

Cheers.


这篇关于在MVC中更新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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