What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 30009 |  Welcome, Guest!   Register  Login
 Home > Forums > ASP.NET > How we provide the source dynamically for Iframe tag ...
Kondapallisrinivas

How we provide the source dynamically for Iframe tag

Replies: 1 | Posted by: Kondapallisrinivas on 10/17/2012 | Category: ASP.NET Forums | Views: 388 | Status: [Member] | Points: 10  


Hello All

I am using the code as shown below

<frameset cols="25%,75%">
<iframe name="frame1" src="http://dotnetfunda.com">
<iframe name="frame2" src="http://www.yahoo.com">
</frameset>

If i use it is okay but now i am tring to get the src(source) from .aspx.cs page

protected void Page_Load(object sender, EventArgs e)
{
int p1 = DateTime.Now.Year;
int p2 = DateTime.Now.Month;
int p3 = DateTime.Now.Day;

URL= "http://hqbusa0369/data/import/NBE/PROD/from_EDI/arc/" + p1 + p2 + p3 ;
}

I want to use that URL as source for frame1.....

Please help for how i have to use that...

Thank you in advance

Regards
Kondapalli Srinivas


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Ranjeet_8
Ranjeet_8  
Posted on: 10/18/2012 12:57:02 AM
Level: Gold | Status: [Member] | Points: 25

Try this.
Write this code on ASPX

<div runat="server" id="Iframe">
</div>

Write this code on ASPX.CS

using System.Text; // Import namespace

StringBuilder sb = new StringBuilder();
sb.Append("<frameset cols='25%,75%'> ");
sb.Append("<iframe name='frame1' src='" + URL + "'> "); // Set your Custom URL
sb.Append("<iframe name='frame2' src='http://www.yahoo.com'> ");
sb.Append("</frameset> ");
Iframe.InnerHtml = sb.ToString();

Kondapallisrinivas, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/22/2013 5:44:39 PM