1

I am using form edit in jqgrid. The grid has additional non-editable columns which are visible. On form editing, these fields are not to be shown but still need to be posted to server.

Any help is appreciated.

Ani
  • 328
  • 1
  • 3
  • 17

3 Answers3

1

If you need to send additional information about non-editable columns which are visible I would recommend you to use onclickSubmit callback. The callback can return object which can be used to extend the data which will be send to the server on form submit. For example the following onclickSubmit implementation

onclickSubmit: function () {
    return {
        test: "bla bla"
    };
}

extend the standard data sent to the server with parameter test which value will be set to the string "bla bla".

You can do for your purpose the following:

onclickSubmit: function (options, postdata) {
    var rowid = postdata[this.id + "_id"]; // like "list_id"
    return {
        myParam: $(this).jqGrid("getCell", rowid, "colName")
    };
}

where "colName" is the value of name property of the column which you need to send.

Such approach seems to me very simple and flexible enough.

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • @Oleg..Can you please help me on this:http://stackoverflow.com/questions/20425210/how-to-handle-errors-in-my-customautorize-attribute-in-asp-net-3-0-application.I have even offered bounty , but its not getting proper attention. – Sai Avinash Dec 09 '13 at 12:26
  • @Avinash: Could you provide small demo project which shows how and where you use `[CustomHandleError]`. Do you need apply error custom error handling for Controller or for specific Action? Do you want to handle some *specific* errors (specific exceptions like `SqlException`) of controller by `[CustomHandleError]` or you want to replace the standard error handling of controller? – Oleg Dec 09 '13 at 12:56
  • @Oleg..Thanks for your response..shall i update question or post a new question? – Sai Avinash Dec 09 '13 at 13:06
  • @Avinash: I think it's better to append your original question with new information. I'm not so good in all aspects of ASP.NET MVC, so probably other person could get you better answer as me. Nevertheless I'll try to help you too. – Oleg Dec 09 '13 at 13:14
  • @Oleg..i have updated the question with sequence of steps , of what i am trying to do, and what is the problem i am getting. Please find Updated2 part of the question.Thanks – Sai Avinash Dec 09 '13 at 13:21
  • @Oleg..i found one clue : Custom Error Handler should handle exceptions that are arising inside controller..which means after reaching controller action. But, here exception is raised even before that controller action is reached. So, the Custom Error Handler should not catch that exception , it should be caught Globally i guess but not by Controllers Error Handler..So, if we can stop that Error handler from not catching the errors from Authorize attribute , we can catch it separetely and redirect to error page which will stop furtur execution . – Sai Avinash Dec 09 '13 at 13:48
  • But, i was not able to modify the code to bypass the exceptions outside controller..you can think this way how to acheive this..if i am not wrong.. – Sai Avinash Dec 09 '13 at 13:49
  • @Avinash: `Authorize` is *action* filter. Isn't so? Probably usage additional `ActionFilterAttribute` (like `HandleJsonExceptionAttribute` from [the answer](http://stackoverflow.com/a/5501644/315935)) is what you need to use? – Oleg Dec 09 '13 at 14:02
  • @Oleg..your are perfectly correct.Setting up the order for the HandleError..solved the problem.Now,i was able to hit the error page, with all the error details..I have to say hundered's of thanks to you..i knew.i was missing some thing..you found it superbly..Can you please write it down as answer..so that i would accept it and it will be useful for other people – Sai Avinash Dec 09 '13 at 14:10
0

Use a hidden input?

<input type="hidden" name="foo" value="bar">

Collin Grady
  • 2,226
  • 1
  • 14
  • 14
-1

or u can set editable false in jqgrid colModel property

{ name: 'pID', index: 'pID', width: 50, editable: false, sortable: false }
Vivekh
  • 4,141
  • 11
  • 57
  • 102
  • Thanks for the answer. Editable:false will make the the grid to not post this property to server. – Ani Dec 09 '13 at 09:57
  • no mention. just mark that as the answer. so that it can be distinguished from other answers.... happy coding. – Vivekh Dec 09 '13 at 10:08