Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to open partial view in iframe but its not working.

What I have tried:

partial view : <pre>@Html.RenderPartial("_ABC", model);


i want to open in iframe

<iframe src='@{Html.RenderPartial("_ABC", model);}' id='fram' ></iframe>


above code will add the data in src but html is blank.
so any one can help me how to open partial view in iframe

Thanks...
Posted
Updated 28-Nov-18 22:24pm

1 solution

The src of the iframe is the url to show in the iframe. Views don't have urls you can navigate to so you'll need a controller action that returns your view and you'll have to set the src to the url of the controller action.

You could also use the srcdoc attribute rather than src but depending on what's in your view that's probably not a good option.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900