How to pass additional postdata into an add record function - JQGrid - MVC . NET(如何将额外的 postdata 传递到添加记录函数 - JQGrid - MVC 中.网)
问题描述
我在 MVC 项目中使用 JQGrid 插件.我试图避免使用会话".使用 JQGrid 中的序列化数据方法,我已经能够将额外的 postdata 传递到我的编辑和删除函数中.
I am using the JQGrid plugin on an MVC project. I am trying to avoid using 'Session'. I have been able to pass extra postdata into my edit and delete functions, using the serializedata methods from JQGrid.
例如
serializeEditData: function (postdata)
{
var rowdata = jQuery('#gridId').getRowData(postdata.id);
return {id: postdata.id, oper: postdata.oper, SomeExtraData: $('#extradata').val()};
}
但是,似乎没有 serializeAddData 函数.是否有另一种方法可以在发送之前更改 add 方法的 post 数据?
However, there doesn't appear to be a serializeAddData function. Is there another way to alter the post data for the add method before it is sent?
推荐答案
有一种方法 editGridRow 实现编辑"和添加"对话框的表单编辑.所以同样的事件han`ler serializeEditData 可以在这两种情况下都使用.例如,
There are one method editGridRow which implement form editing for both "Edit" and "Add" dialogs. So the same event han`ler serializeEditData can be used in both cases. For example,
$("#list").jqGrid('navGrid','#pager',
{/*navGrid options*
本文标题为:如何将额外的 postdata 传递到添加记录函数 - JQGrid - MVC 中.网
基础教程推荐
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
