Pass a hidden jqGrid value when editing on ASP.Net MVC
Posted
by taylonr
on Stack Overflow
See other posts from Stack Overflow
or by taylonr
Published on 2010-05-22T04:24:05Z
Indexed on
2010/05/22
4:30 UTC
Read the original article
Hit count: 411
I have a jqGrid in an ASP.Net MVC.
The grid is defined as:
$("#list").jqGrid({
url: '<%= Url.Action("History", "Farrier", new { id = ViewData["horseId"]}) %>',
editurl: '/Farrier/Add',
datatype: 'json',
mtype: 'GET',
colNames: ['horseId', 'date', 'notes'],
colModel: [
{ name: 'horseId', index: 'horseId', width: 250, align: 'left', editable:false, editrules: {edithidden: true}, hidden: true },
{ name: 'date', index: 'farrierDate', width: 250, align: 'left', editable:true },
{ name: 'notes', index: 'farrierNotes', width: 100, align: 'left', editable: true }
],
pager: jQuery('#pager'),
rowNum: 5,
rowList: [5, 10, 20, 50],
sortname: 'farrierDate',
sortorder: "DESC",
viewrecords: true
});
What I want to be able to do, add a row to the grid, where the horseId is either a) not displayed or b) greyed out. But is passed to the controller when saving.
The way it's set up is this grid will only have 1 horse id at a time (it will exist on a horse's property page.)
The only time I've gotten anything to work is when I made it editable, but then that opens it up for the user to modify the id, which isn't a good idea.
So is there some way I can set this value before submitting the data? it does exist as a variable on this page, if that helps any (and I've checked that it isn't null).
Thanks
© Stack Overflow or respective owner