Insert a Partial View @Html.Partial into an iframe

Asked

Viewed 138 times

-1

I need to insert a Partial View of Asp.net mvc into a iframe but View is not opening.

Can someone give me some hint?

I tried the code below, but it didn’t work:

iframe src="@Html.Partial("_AGD")" height="500" > /iframe> 

1 answer

0


Create an Action in your Controller to return this Partial View, and on href of his do iframe point to your action.

Example:

Controller

public ActionResult Agd() {
    return PartialView("_AGD");
}

View

<iframe src="@Url.Action("NomeAction", "NomeController")" height="500" />
  • Mouse, something so simple, vlw my friend! excuse for ignorance! hugging!

  • @Paulofreitas Magina, the community here is for that same. If the answer was useful to you, if you can mark it as accepted , so when other users view your question they will see that you already have a correct answer and accepted by you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.