1

I'm new with MVC and I need to put into an iframe a view which returns the content of a page( styles/css,text/html,images etc) and the view to containt the main menu of the application, from the Index view.

Can anyone help me with this?

The code line which returns the content in the view is :

@Html.Raw(System.Text.Encoding.ASCII.GetString(@Model.Content))

1 Answer 1

1

Just try to create controller with action that returns your view.

public class MyController
{
   public ActionResult Index()
   {
       return View();
   }
}

index view content:

@Html.Raw(System.Text.Encoding.ASCII.GetString(@Model.Content))

After that

<iframe src="localhost/mycontroller">    
</iframe>
Sign up to request clarification or add additional context in comments.

2 Comments

i have that controller named Template and even if i put <iframe src="localhost:4784/Template"></iframe> tag after @Html.Raw[..], it doesn't work
Let's clarify things. Template controller should have one action method that returns view with @Html.Raw[...]. <iframe> tag with src="localhost/Template" should be located in other view.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.