Solved

Need to Pass Dynamic src value to Iframe in ASPX Page

Posted on 2013-06-17
1
2,124 Views
Last Modified: 2013-06-18
Hello Folks

I have an ASPX page that loads from a selected hyperlink from another page which contains lists of customers.

CustomerDisplay.aspx?key1=8

It is passed a value (key1) which is retrieved by the Request.Querystring.
This is the DB key needed to run another ASPX page which is contained in an iframe.

<iframe id="ifrm1" runat=server src="CustomerPayments.aspx?key1=8" />

Hardcoding the src URL plus key parameter successfully launches the second ASPX page and lists the display in the iframe.

The problem I'm having is finding a good way to assign the iframe src parameter dynamically so the CustomerDisplay will show payments for any customer.

Does anyone have a easy suggestion?

Thanks

Bob
0
Comment
Question by:Bob_ET
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 8

Accepted Solution

by:
johny_bravo1 earned 250 total points
ID: 39254043
This is your iframe
<iframe id="ifrm1" runat=server src="CustomerPayments.aspx?key1=8" />

You can add attributes from code behind like this,
ifrm1.Attributes.Add("src", "CustomerPayments.aspx?key1=8");

Or

ifrm1.Attributes["src"] = String.Format("CustomerPayments.com?key1={0}",Request.QueryString[0].ToString());
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

705 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