[Webinar] Learn how to a build a cloud-first strategyRegister Now


jqGrid/MVC: How to add a static value to a column

Posted on 2011-05-06
Medium Priority
Last Modified: 2012-06-21

I want to know how to add a static value to a column of jqGrid in MVC project.
I want to be able to implement the following sample using jqGrid, and I need help with adding value "static column" to each row:

- aspx code:
<asp:GridView ID="gvResult" runat="server" AutoGenerateColumns="false">
                <asp:BoundField HeaderText="c1" DataField="c1" />
                        static column                    

- Code behind:
protected void Page_Load(object sender, EventArgs e)
            DataTable dt = new DataTable();
            dt.Columns.Add("c1", typeof(string));

            for (int i = 0; i < 5; i++)
                DataRow dr = dt.NewRow();
                dr["c1"] = i;

            gvResult.DataSource = dt;

- Result:
 Desired Result
Question by:fippif
  • 2
LVL 27

Expert Comment

by:Sammy Ageil
ID: 35739197
first of all, why are you using a gridview in your example?
Are you planning to use webform controls in MVC?
jQgrid doesnt care where the data comes from, your server code will send it and it will comply.
look into the grid implementations
look at this simple example http://bartreyserhove.blogspot.com/2008/08/aspnet-mvc-and-jqgrid.html

Accepted Solution

fippif earned 0 total points
ID: 35744149
I was able to resolve my issue by using Formatter.

Author Closing Comment

ID: 35767727
I found the answer I was looking for by myself.

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question