RBS
asked on
Passing Json Object Server-Side to MVC ViewResult
Hi:
I have an application in which I need to make a Web Service call to another site that returns a DataSet containing the courses that a particular person has taken - say fields CourseId, CourseTitle, DateRegistered. I would like to use that DataSet to create a table in a ViewResult so that I can display a table of courses that the person has taken. I have thought of converting the table into a Json object but am still at a loss as to how to use that data to display a table. Any help greatly appreciated. Here's what I have so far:
Any help greatly appreciated.
RBS
I have an application in which I need to make a Web Service call to another site that returns a DataSet containing the courses that a particular person has taken - say fields CourseId, CourseTitle, DateRegistered. I would like to use that DataSet to create a table in a ViewResult so that I can display a table of courses that the person has taken. I have thought of converting the table into a Json object but am still at a loss as to how to use that data to display a table. Any help greatly appreciated. Here's what I have so far:
public ActionResult CheckHcr()
{
var viewModel = new CheckHcrViewModel
{
FirstName = Request.QueryString["FirstName"],
LastName = Request.QueryString["LastName"]
};
return View(viewModel);
}
[HttpPost]
public ActionResult CheckHcr(CheckHcrViewModel hcrCheckName)
{
if (!ModelState.IsValid)
{
return View(hcrCheckName);
}
String dsJSON = HcrServices.HC_Qualification_Check(hcrCheckName);
return RedirectToAction("DisplayCoursesTaken", "ManageHcr", new { ????????? });
}
public static string HC_Qualification_Check(CheckHcrViewModel p)
{
var hcr = new Service();
var dsReturn = new DataSet();
try
{
dsReturn = hcr.ws_HDCO_Qualification_CHECK("SecretWebService", "SecretPassword", p.FirstName, p.LastName, p.BirthDate);
}
catch (Exception e)
{ Utilities.LogError(e); }
var test = JsonConvert.SerializeObject(dsReturn);
return test;
}
Any help greatly appreciated.
RBS
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER