2013-07-16 13 views
6

Sposób korzystania z metody Url.Action w atrybucie iframesrc. Takich, jakSposób korzystania z Url.Action w iframe src

<iframe src = '<%=Url.Action("HelloWorld", "myController");%>' width = "100%" height="1000" frameBorder="0"></iframe> 

Ale nie działa poprawnie. Mówi, że żądana treść nie jest dostępna.

Proszę mi pomóc

Odpowiedz

10

na silniku ASP.NET

<iframe src = '<%: Url.Action("HelloWorld", "myController") %>' width = "100%" 
    height="1000" frameBorder="0"></iframe> 

Korzystanie silnik maszynki.

<iframe src = '@Url.Action("HelloWorld", "myController")' width = "100%" 
    height="1000" frameBorder="0"></iframe> 
0
Same here found error in getting what type of Controller should be? so this is the best solution if you are using IFrame for PDF Viewer and I hope this code will be useful. 


<iframe src="@Url.Action("GetPDF")" id="sign" width="800" height="800"></iframe> 

    public FileStreamResult GetPDF() 
     { 
      var path = "E:\\FirstTask\\FirstTask\\FolderToSave\\Patient Consent.pdf"; 
      FileStream fs = new FileStream(path, FileMode.Open, FileAccess.ReadWrite); 
      return File(fs, "application/pdf"); 
     } 
Powiązane problemy