Solved

Need to Pass Dynamic src value to Iframe in ASPX Page

Posted on 2013-06-17
1
2,002 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
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now