0

i'm using asp.net mvc 2 and Simplemodal with iframe

it works great but my controller is being called twice when opening in iframe when i call the page directly, the controller is called only once

 $.modal('<iframe id="frmDetails" src="' + src + '" >', { containerCss: { height: "90%", width: "90%"} });

is there an option that i'm missing, it's a very simple call.

Thanks

freddoo
  • 6,770
  • 2
  • 29
  • 39
  • Looks like a duplicate question....[when using SimpleModal and open an Iframe it is calling the src twice](http://stackoverflow.com/questions/4330774/when-using-simplemodal-and-open-an-iframe-it-is-calling-the-src-twice). – Scott Brady Sep 11 '12 at 05:22

4 Answers4

1

I have the same problem. When the top page (which contains the iframe) and the page loaded in the iframe both load jquery, it does load the iframe twice. If you remove the jquery from the top page, it only loads once.

A workaround I don't have at the moment.

Reto Laemmler
  • 51
  • 1
  • 1
  • 5
1

Check to make sure that you don't have the jquery js file or other javascript files included more than once.

drenz
  • 11
  • 1
0

I suggest, that in your case, when you call $.model it creates some (for example div) hidden element where stored html of your modal window. In this point iframe is loading 1st time in hidden element. Then it shows to user - creates new not hidden element with new iframe, that's why u'll get second call. Possible you should define src of iframe only when it's showing to user. So if i'm right you will have 2 iframes. Choose right selector for your iframe that is not hidden.

Eugene K.
  • 85
  • 1
  • 11
0

Try

$.modal('<iframe id="frmDetails" src="' + src + '" ></iframe>', {
    containerCss: { height: "90%", width: "90%"},
    appendTo: 'form'
});
Eric Martin
  • 2,841
  • 2
  • 23
  • 23