Passing parameters to an ASP.NET page running in an IFRAME
9901 ワード
Introduction
I am building a content management intranet for my company. The website is based on DotNetNuke , and uses the excellent FreeTextBox control in order to enter HTML into the articles. One of the best features of
FreeTextBox
is that you can easily add your own buttons and functionality to the control. For instance, the built-in function for adding images didn't meet my needs. My images are stored in SQL server, and require a custom src
property in order to retrieve the image. No problem - I added a new button to the control, and built a small aspx page that opens in a modal (popup) window. The popup window allows the user to choose an image to insert, or upload a new image to be inserted. But that's where my problems began. The Problem
If you've never tried to run an aspx page in a modal window before, then I've probably already lost your attention. But if you have, then you've most likely run into a rather odd problem. Just opening and running an aspx page in a modal window works fine, but if you need to do anything that causes a postback, a funny thing happens. The page opens up in a new window. Worse yet, the new window that opens doesn't have any of the data that you just submitted. The whole thing is a total wash. And JavaScript isn't terribly helpful. What to do?
Enter the IFrame
The trick to solving this problem is to wrap the aspx page in a "doorway"page. That is, you make another page that contains an