below is a piece of code that returns a view of the jquery function, but I like to know how I can extract or get the html view and return to the end of the client.
$(function() { $('#myddl').change(function() { var url = $(this).data('url'); var value = $(this).val(); $('#result').load(url, { value: value }) }); }); <div id="result"></div>
and inside the Foo action you can return a partial view:
public ActionResult Foo(string value) { SomeModel model = ... return PartialView(model); }
in a web form this way I extarct usercontrols or any html management related files.
System.Web.UI.Page pageHolder = new System.Web.UI.Page(); BBAReman.facebox.FeedBack ctl = (BBAReman.facebox.FeedBack)pageHolder.LoadControl("~/UserControls/FeedBack.ascx"); System.Web.UI.HtmlControls.HtmlForm tempForm = new System.Web.UI.HtmlControls.HtmlForm(); tempForm.Controls.Add(ctl); pageHolder.Controls.Add(tempForm); StringWriter output = new StringWriter(); HttpContext.Current.Server.Execute(pageHolder, output, false); outputToReturn = output.ToString();
so how to do the same in mvc. just how to find out how I can get the html view from the action method. thanks
source share