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 中.网


基础教程推荐
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 如果条件可以为空 2022-01-01
- 将数据集转换为列表 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 获取C#保存对话框的文件路径 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01