0

I created an ASP.NET core project, with .NET 5, and it contains iFrames whose src attribute referencing an SSRS report:

<iframe src=@($"http://localhost/MyReportSvc?param1=...") scrolling="no" style="width:625px;height:100%" frameborder="0" />
        

but the content is dynamic and the iframe height changes depending of the URL parameters.

Please tell me if there exists a way (surely in javascript) to have the height set automatically depending of the content' height.

thank you

plz note : I found this : related page, but I can't make it work in my blazor project. I hope it's not a cache problem. Can somebody try this and tell me if it works in a blazor project with .NET5?

lolveley
  • 1,659
  • 2
  • 18
  • 34

1 Answers1

0

You'll be wanting to learn about JsInterop.

Also note that Blazor can gain a reference to a specific html element using @ref, which can then be passed to your JavaScript functions.

Once you've researched JsInterop and @ref, if you still have any questions, please come back with more specifics, and I'm sure we can get you sorted out. :D

Bennyboy1973
  • 3,413
  • 2
  • 11
  • 16
  • I already used JSInterop, but with DOM searches, maybe I should use `@ref` as you suggested. I will try and tell you if it works. – lolveley Apr 05 '21 at 21:08
  • @ref just gives you a reference you can pass to JavaScript. You can also just use JavaScript like normal-- searching for elements by class, etc. In fact, I don't think you even need to use JsInterop at all-- I believe if your script loads on window events, it will run just by including it. – Bennyboy1973 Apr 05 '21 at 22:24