Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
This is my code of .cshtml page. Here I passed the hardcoded values of "colNames". Problem is I want to fetch that values from database.

C#
jQuery(document).ready(function () {

       var myGrid = $('#jQGrid1');
       myGrid.jqGrid({
           height: 'auto',
           autowidth: true,
           caption: "Claim",
           url: 'Claim/GetRecords1/',
           datatype: "json",
           contentType: "application/json; charset-utf-8",
           mtype: 'POST',
           colNames: ['ClaimId', 'Customer Name', 'Amount', 'Date', 'Approved'],
           colModel: [{ name: 'ClaimIde' },
                       { name: 'CName' },
                       { name: 'Amount' },
                       { name: 'Date' },
                       { name: 'Approved'}],
           viewrecords: true,
       });
Posted
Comments
SRS(The Coder) 7-Jan-15 7:38am    
You have to make a jQuery Ajax call and you will get those column names as json formatted data which you can use to set the column names here for the jQGrid.
Member 11149146 21-Jan-15 5:34am    
Thanks SRS(The Coder). I have Done It.

1 solution

You have to make a jQuery Ajax call and you will get those column names as json formatted data which you can use to set the column names here for the jQGrid.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900