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 8936709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:16:27+00:00 2026-06-15T10:16:27+00:00

SCRIPTS: <script type=text/javascript> $(document).ready(function () { $(#grid).jqGrid({ url: ‘@Url.Action(GetAllCategories, Admin)’, datatype: json, mtype: ‘GET’,

  • 0

SCRIPTS:

<script type="text/javascript">
$(document).ready(function () {
    $("#grid").jqGrid({
        url: '@Url.Action("GetAllCategories", "Admin")',
        datatype: "json",
        mtype: 'GET',
        colNames: ['sno','Kategori Adı', 'Sıra No', 'Vitrin'],
        colModel: [
                { name: 'sno', index: 'sno', editable: false, hidden: true },
                  { name: 'Name', index: 'Name', editable: true },
                  { name: 'OrderNo', index: 'OrderNo', editable: true },
                  { name: 'IsShowcase', index: 'IsShowcase', width: 100, editable: true, sortable: false }
        ],
        jsonReader: {
            repeatitems: false
        },
        rowNum: 10,
        rowList: [10, 20, 30, 40, 50],
        pager: jQuery('#gridpager'),
        sortname: 'CategoryName',
        viewrecords: true,
        sortorder: "asc",
        id: "sno",
        width: 710,
        height: 300,
        editurl: '@Url.Action("_EditCategory", "Admin")'
    }).navGrid('#gridpager');
});
</script>

CONTROLLER

[HttpPost]
public ActionResult _EditCategory(CategoriesViewModel categoriesViewModel)
{
    Categories category = entity.Categories.SingleOrDefault(x => x.sno == categoriesViewModel.sno);
    category.IsShowcase = categoriesViewModel.IsShowcase;
    category.Name = categoriesViewModel.Name;
    category.OrderNo = categoriesViewModel.OrderNo;
    try
    {
        entity.Categories.Add(category);
        entity.SaveChanges();
    }
    catch (Exception ex) { }

    return PartialView(categoriesViewModel);
}

I debugged it. I cant post only sno of model(sno is the primary key of Model and uniq). Model is posted with parameters, but only sno is not posted.

How can I achieve this? 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-15T10:16:28+00:00Added an answer on June 15, 2026 at 10:16 am

    First thing that concerns me in your code is the id option which you use – jqGrid doesn’t have such option. If that option was suppose to make jqGrid resolve the row id out of your model, than you should have use jsonReader for this purpose:

    $("#grid").jqGrid({
        ...
        jsonReader: {
            repeatitems: false,
            id: 'sno'
        },
        ...
    }).navGrid('#gridpager');
    

    Now assuming that your rows ids are bound properly, you can use prmNames option to tell jqGrid that it should POST row id under sno name:

    $("#grid").jqGrid({
        ...
        jsonReader: {
            repeatitems: false,
            id: 'sno'
        },
        prmNames: {
            id: 'sno'
        },
        ... 
    }).navGrid('#gridpager');
    

    This should resolve your issue.

    P.S. Most probably you don’t need sno column in your columns model (and columns names) definition as you use it only for row id.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<table id=UsersGrid></table> <script type=text/javascript> $(document).ready(function () { $('#UsersGrid').jqGrid({ colNames: ['Online', 'Computer', 'IP', 'User'], colModel:
#!/usr/bin/perl print Content-type: text/html \n\n; print qq(<html> <head> <script type=text/javascript src=/jquery.js></script> <script> jQuery(document).ready(function(){ jQuery(#form_lang).submit(function(e){
I have a jQuery script: $.ajax({ url: /scripts/secure/development/ajax.asp, type: POST, dataType: text, data: cmd=addresses,
Here is fragments of my HAML view: %script{:type => text/javascript, :src => assets/application.js} :javascript
I have this code <html> <head> <script src=jquery-1.7.2.min.js type=text/javascript></script> <script src=jquery-ui-1.8.20.custom.min.js type=text/javascript></script> <script type
I am calling a service that return JSON data. Script: $.ajax({ type: "POST", url:
I have this jQuery script var dataString = class_id=+class_id; $.ajax({ type: POST, url: page.php,
I'm attempting to select all <script type=text/html> tags in a page. I use <script>
I've tried to change filenames using following script: find dir/ -type f -exec mv
OK I have a simple script at http://kleague.org/test/ Type a movie name and it

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.