Unknown Coder
Unknown Coder

Reputation: 6731

Pass a variable from ASP.NET to HTML via Iframe?

I don't know if this is even possible, but here goes: I have an ASP.NET page that contains an IFrame that calls an HTML page. Is it possible to pass a variable from the ASP.NET page to the HTML within the IFrame? More specifically, I'd like for the ASP.NET page to fill in one of the fields on the form within the HTML page.

Upvotes: 0

Views: 1226

Answers (2)

DancesWithBamboo
DancesWithBamboo

Reputation: 4156

If you only need it to work with the latest browsers then window.postMessage is the way to go to communicate between frames.

See: http://msdn.microsoft.com/en-us/library/cc197015

Upvotes: 0

Jemes
Jemes

Reputation: 2842

You could do something like this:

window.frames['IFrameName'].document.getElementById('TextBoxID').value='YourValue';

Upvotes: 1

Related Questions