Dynamic iFrame  - June 2012

If you download this tip please consider making a modest donation.

An iFrame, a HtmlGenericControl, can be used to insert a web page into an Asp.Net page. I had a requirement to allow persons who have independently developed html pages to display them in the main application. The process is described in this June 2012 tip-of-the-month. I created an Asp.Net, VB.Net application to demonstrate the process. Click here to run the demo.

The Demo Application

The Asp.Net, VB.Net, VS/2008 project DynamicIFrame is documented here.

iFrame Parameters

Embed this URL - The Url of the page to be displayed in the iFrame. http:// is required.

Width Percent - Set the iFrame width percentage. Usually 100 percent.

Height Pixels - The iFrame's height in pixels. The iFrame will be displayed using this value for its height.

Margin Width - This number of pixels will be added to the left and right iFrame margins. The page is centered between these margins.

Margin Height - This number of pixels will be added to the top and bottom of the page in the iFrame.

Frame Border - If checked the iFrame is displayed with a border.

Scroll Bars - Select Auto, Yes or No to indicate if the iFrame is to show scroll bars. If 'Auto' then scroll bars are added as needed. If 'Yes' then scroll bars are always added. If 'No' then scroll bars are never added.

Popup Page Parameters

Width - The width of the popup page in pixels.

Height - The height of the popup page in pixels. If the width or height value exceeds the screen size the page is maximized within the available space.

Top - Display the page this number of pixels from the top.

Left - Display the page this number of pixels from the left.

Action Buttons

Update - After changing parameters click this button to store values submitted and set the Preview buttons 'on click' attributes.

Preview - Click the button to display the selected Url in a popup page. For example:


The popup page which contains an iFrame control.

Download the VB.Net Code

Download the source code by clicking on the zipped file name. Click here to run the demo application.

Download - Source Zipped File Size
VS/2008 VB.Net, ASP.Net Solution DynamicIFrame.zip 93k

Previous Tip    Tip Index    Next Tip

Home

Updated 2012/07/22