I am submitting my object to my wcf service. This object has a KnownType attribute that I am using to populate the data to be sent.
public ActionResult Preview(int id, FormCollection collection)
{
var model = ContentPageEdit.GetContentPageById(id, true);
TryUpdateModel(model, collection);
//ServiceReference1.Service1 client = new localhost.Service1();
// need knownTYpe attritube on wcf project
ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
SFAdmin.Web.ServiceReference1.ContentPageEdit obj = new ServiceReference1.ContentPageEdit();
obj.age = (int)model.Id;
obj.htmlContent = model.ContentBody;
string viewModel = client.ComputeObject(obj);
//// BINDING OBJECT FOR USE WITH META TAG BUILDER
//TempData["contentPageClone"] = currentPage;
//TempData["keywords"] = currentPage.Keywords;
//TempData["description"] = currentPage.ShortDescription;
//// used for captcha code - to prevent injection
//// it is checked in the utilities controller
//TempData["CaptchaCode"] = SF.Library.Security.RandomKeyGenerator.Generate(5);
//TempData["title"] = currentPage.PageTitle;
//currentPage.FullHTMLRender = currentPage.ContentBody;
//this.ViewData.Model = model;
return RedirectToAction("PreviewObject", new { obj = model });
}
The issue, is that it is a 2 way request because I would like to render this view of this model inside of my mvc application using the view from another web application. I am requesting www.mysite.com/abc/def be the view that my model will be passed into
using jquery function $.toJSON.
HOW can I get a razor view to be rendered as a view and returned to my service with jquery assistance?
Xequence
Contributor
4303 Points
1528 Posts
request razor view in webservice
Apr 04, 2012 01:29 PM|LINK
I am submitting my object to my wcf service. This object has a KnownType attribute that I am using to populate the data to be sent.
public ActionResult Preview(int id, FormCollection collection) { var model = ContentPageEdit.GetContentPageById(id, true); TryUpdateModel(model, collection); //ServiceReference1.Service1 client = new localhost.Service1(); // need knownTYpe attritube on wcf project ServiceReference1.Service1Client client = new ServiceReference1.Service1Client(); SFAdmin.Web.ServiceReference1.ContentPageEdit obj = new ServiceReference1.ContentPageEdit(); obj.age = (int)model.Id; obj.htmlContent = model.ContentBody; string viewModel = client.ComputeObject(obj); //// BINDING OBJECT FOR USE WITH META TAG BUILDER //TempData["contentPageClone"] = currentPage; //TempData["keywords"] = currentPage.Keywords; //TempData["description"] = currentPage.ShortDescription; //// used for captcha code - to prevent injection //// it is checked in the utilities controller //TempData["CaptchaCode"] = SF.Library.Security.RandomKeyGenerator.Generate(5); //TempData["title"] = currentPage.PageTitle; //currentPage.FullHTMLRender = currentPage.ContentBody; //this.ViewData.Model = model; return RedirectToAction("PreviewObject", new { obj = model }); }The issue, is that it is a 2 way request because I would like to render this view of this model inside of my mvc application using the view from another web application. I am requesting www.mysite.com/abc/def be the view that my model will be passed into using jquery function $.toJSON.
HOW can I get a razor view to be rendered as a view and returned to my service with jquery assistance?
Credentials
Winston He
Member
38 Points
9 Posts
Re: request razor view in webservice
Apr 16, 2012 04:58 AM|LINK
Hi,
it's a question about MVC, would you please post this question to MVC forum: http://forums.asp.net/1146.aspx/1?MVC