[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Setting the src of IFRAME.

Posted on 2005-04-06
2
Medium Priority
?
460 Views
Last Modified: 2010-04-16
Hi,

I have a WebForm with an IFRAME. I need to be able to set the src of the IFRAME dynamically. Since there is no standard IFRAME control in asp.net I tried to set the src of the IFRAME by calling a procedure in the code behind page:

-----------------------------------------------------------------------------------------------------
html part:

<iframe id="ifCarFrame" name="ifCarFrame" src="<%# getCarFormAddress()%>">
-----------------------------------------------------------------------------------------------------
code behind part:

public string getCarFormAddress()
{
     //Builds the address for the ChatterBox
     string carFormAddress;

     carFormAddress = "carform.aspx";
                  
     return carFormAddress;
}
-----------------------------------------------------------------------------------------------------

The problem is that it is sending a blank to the WebForm.

Does anyone know how to send a string to the src in an IFRAME html-control?

Thanks for your help,
K2
0
Comment
Question by:tnook
2 Comments
 
LVL 17

Accepted Solution

by:
Jesse Houwing earned 800 total points
ID: 13722118
<iframe id="ifCarFrame" name="ifCarFrame" src="" runat="server">

Add the following to the members list in the code behind:

          protected HtmlGenericControl ifCarFrame;

You can set the src from code as follows:

          private void Page_Load(object sender, System.EventArgs e)
          {
               ifCarFrame.Attributes["src"] = "newpage.aspx";
               // Put user code to initialize the page here
          }
0
 

Author Comment

by:tnook
ID: 13722301
Genius!!! Thanks!!!

K2
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month19 days, 17 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question