newcoder
newcoder

Reputation: 25

mvc3 render view from iframe

I have a controller which creates a url for an iFrame by calling a webservice. I need to create a view and a model and pass this url of the iFrame to the view. How do i do that? Thanks.

Upvotes: 0

Views: 710

Answers (1)

Kev
Kev

Reputation: 2726

// Controller
ViewBag.IframeUrl = theIframeUrl;
View("ViewName");

//View
<iframe src="@ViewBag.IframeUrl"></iframe>

This is the simplest way. Depending on your problem you may want to use a model / viewmodel.

Upvotes: 1

Related Questions