Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8999183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:08:47+00:00 2026-06-16T00:08:47+00:00

jqGrid $(document).ready(function () { $(#grid).jqGrid({ url: ‘@Url.Action(GetAllAuthors, Admin)’, datatype: json, mtype: ‘get’, colNames: [‘Yazar

  • 0

jqGrid

$(document).ready(function () {

    $("#grid").jqGrid({
        url: '@Url.Action("GetAllAuthors", "Admin")',
        datatype: "json",
        mtype: 'get',
        colNames: ['Yazar Adı', 'Öz Geçmiş'],
        colModel: [
                  { name: 'Name', index: 'Name', editable: false },
                  { name: 'Description', index: 'Description', editable: false }
        ],
        jsonReader: {
            repeatitems: false,
            id: "sno",
            root: "rows", //array containing actual data
            page: "page", //current page
            total: "total", //total pages for the query
            records: "records", //total number of records
            repeatitems: false
        },
        rowNum: 10,
        rowList: [10, 20, 30, 40, 50],
        pager: jQuery('#gridpager'),
        sortname: 'Name',
        viewrecords: true,
        sortorder: "asc",
        width: 710,
        height: 300
    })
    .navGrid('#gridpager', { edit: false, add: false, del: false, search: false, refresh: false })
    .navButtonAdd('#gridpager', {
        caption: "Düzenle",
        buttonicon: "ui-icon-pencil",
        onClickButton: function () {
            var grid = $("#grid");
            var rowid = grid.jqGrid('getGridParam', 'selrow');
            //alert(rowid + " - " + grid.jqGrid('getCell', rowid, 'CustomerName') + " - Link: " + $("#customers_grid_table a.customer_details").attr("href"));
            window.location = '@Url.Action("EditAuthor", "Admin")?authorId=' + rowid;
            //LoadAction('@Url.Action("EditAuthor", "Admin")?authorId=' + rowid);
        }
    });  //end jqgrid
});

I have two method in my controller

Get method

[HttpGet]
public ActionResult EditAuthor(int authorId)

Post method

[HttpPost]
public ActionResult EditAuthor(AuthorViewModel model, HttpPostedFileBase file)

I selected a row and clicked edit button, I expect to fire get method, but post method is fired. What can I do to fire get method?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:08:47+00:00Added an answer on June 16, 2026 at 12:08 am

    If you set new value of window.location the HTTP GET will be used. To produce HTTP POST you can either use $.ajax or submit some form. You can for example dynamically build invisible <form> and submit it. For example

    onClickButton: function () {
        var rowid = $(this).jqGrid("getGridParam", "selrow"),
            myForm = document.createElement("form"),
            param1 = document.createElement("input");
    
        myForm.action = '@Url.Action("EditAuthor", "Admin")';
        myForm.method = "POST";
        myForm.style.display="none";
    
        param1.name = "authorId";
        param1.type = "text";
        param1.value = rowid;
        myForm.appendChild(param1);
    
        document.body.appendChild(myForm);
        myForm.submit();
        document.body.removeChild(myForm);
    }
    

    I recommend you additionally to include additional validation whether some row is selected (whether rowid is not null).

    Moreover I recommend you

    • to use always gridview: true option in the grid which will just improve the performance of the grid.
    • replace the option pager: jQuery('#gridpager') to pager: '#gridpager'.
    • replace the current value of jsonReader option to jsonReader: {repeatitems: false, id: "sno"}. The options which you specify will be combined with default value (see the documentation). Additionally your current value of jsonReader option contains syntax error because you specify the same property repeatitems: false twice.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SCRIPTS: <script type=text/javascript> $(document).ready(function () { $(#grid).jqGrid({ url: '@Url.Action(GetAllCategories, Admin)', datatype: json, mtype: 'GET',
$(document).ready(function(){ jQuery(#list2).jqGrid({ //url:server.json, datatype:'local', //mtype:'GET', colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90},
I have my jQuery code like this $(document).ready(function () { var lastsel; $('#jqgProducts').jqGrid({ //url
I have the below code in my jqgrid <script type=text/javascript> jQuery(document).ready(function() { var grid
I've implemented a jqgrid with inline edit: var lastSel; jQuery(document).ready(function () { jQuery(#list).jqGrid({ url:
I have a jqGrid script like that: jQuery(document).ready(function() { var startDate = $(#startDate).Val(); jQuery(#sandgrid).jqGrid({
If I declare a function inside document.ready, I get an error. Like this $(document).ready(function(){
<table id=UsersGrid></table> <script type=text/javascript> $(document).ready(function () { $('#UsersGrid').jqGrid({ colNames: ['Online', 'Computer', 'IP', 'User'], colModel:
My JqGrid code is as given below $('#grid').jqGrid({ url: '', scroll: 1, postData: {
I ran into a problem with jqGrid and JSON data. Basically the grid will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.