Solved

Need to Pass Dynamic src value to Iframe in ASPX Page

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
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 style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

861 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

23 Experts available now in Live!

Get 1:1 Help Now