[RESOLVED]get the selected rows first field id value for jqgrid using jquery


i need a cell value for selected rows  first field id value for jqgrid using jquery

please someone help for me.

In JavaScript:

var rowid = $('#YourGridId').jqGrid('getGridParam', 'selrow');

// assign the value from a cell in the selected grid row to a variable of your choice:
var YourCellValue = $('#YourGridId').jqGrid('getCell', rowid, 'YourCellId')


thanks for u reply

how to call on select row function for jqgrid in jquery.

Hi Ananth,

Sample for onSelectRow

 $(document).ready(function() {
        $(function() {
                url: '@Url.Action("Grid", "Name")',
                datatype: "json",
                edit: false,
                add: false,
                del: false,
                height: 330,
                mtype: 'GET',
                colNames: ['ID','Name'],
                jsonReader: {
                    root: "Clients",
                    page: "CurrentPage",
                    total: "TotalPages",
                    records: "TotalRecords",
                    repeatitems: false,
                    cell: "",
                    id: "0"
                colModel: [
                    { name: 'Id', index: 'Id', width: 65, align: 'center', sorttype: "int" },
                    { name: '@NameMap.STATUS_COLUMN', index: '@NameMap.STATUS_COLUMN', width: 140, align: 'left', sortable: true }],
                pager: '#pager',
                rowNum: 10,
                rowList: [10, 15, 20],
                sortname: 'Id',
                sortorder: 'asc',
                viewrecords: true,
                gridview: true,                    
                onSelectRow: function (id) {
                                url: '@Url.Action("Details","Name")',
                                data: { 'Id': id },
                                success: function (detailsHtml) {
                                dataType: 'html'
                loadComplete: function () {

k thank you

i get back to you soon……

Leave a Reply