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 中.网
基础教程推荐
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- WPF 模态进度窗口 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
