ASP MVC JSON ARRAY
Hi everyone,i am working on a mobile mvc application.I have the following code to get data from linq:
public class ShipperController : Controller
{
FxDataClassesDataContext dcfx = new FxDataClassesDataContext();
public ActionResult GridActiveQuotes(string sidx, string sord, int page, int rows)
{
int pageIndex = Convert.ToInt32(page) - 1;
int pageSize = rows;
int totalRecords = dcfx.FxVwQuotes.Count();
int totalPages = (int)Math.Ceiling((float)totalRecords / (float)pageSize);
var opp = (sord == "asc") ?
dcfx.FxVwQuotes
.Skip(pageIndex * pageSize)
.Take(pageSize)
:
dcfx.FxVwQuotes
.Skip(pageIndex * pageSize)
.Take(pageSize);
var jsonData = new
{
total = totalPages, // Work item
page = page,
records = totalRecords, // Work item
rows = (
from Quotes in dcfx.FxVwQuotes
select new
{
id = Quotes.Quote_ID,
cell = new string[] {
Quotes.Quote_ID.ToString(),
Quotes.Transporter_Name.ToString(),
Quotes.Transporter_Reputation_Score.ToString(),
Quotes.Opportunity_Cargo_Description.ToString(),
Quotes.Opportunity_Origin.ToString(),
Quotes.Opportunity_Origin_Country_Code.ToString(),
Quotes.Opportunity_Destination.ToString(),
Quotes.Opportunity_Destination_Country_Code.ToStri ng(),
Quotes.Quote_Currency.ToString(),
Quotes.Quote_Price.ToString()
}
}).ToArray()
};
return Json(jsonData, JsonRequestBehavior.AllowGet);
}
I would like to display this array in a html listview or table on a .cshtml file(View).PLEASE HELP
|