This is a migrated thread and some comments may be shown as answers.

Programmatically change iframe's source

6 Answers 90 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Rohit
Top achievements
Rank 1
Rohit asked on 15 Sep 2011, 10:12 PM
Hello All,

How can I programatically change the source (src) attribute of an iframe that's in a RadPageView which is in turn tied to a RadTabStrip tab? Meaning.. I would like to achieve something like this:

If variable temp1's value is 1:
<telerik:RadPageView ID="RadPageView2" runat="server">
                <iframe width="100%" height="100%" src="Page1.aspx" ></iframe>
</telerik:RadPageView>

If variable temp1's value is 2:
<telerik:RadPageView ID="RadPageView2" runat="server">
                <iframe width="100%" height="100%" src="Page2.aspx" ></iframe>
</telerik:RadPageView>

Something on the line of:
if(temp1 == 1)
{
               RadPageView2.iframe.setSource("Page1.aspx");
}
else if (temp1 == 2)
{
               RadPageView2.iframe.setSource("Page2.aspx");
}

Thanks in advance !!

6 Answers, 1 is accepted

Sort by
0
Steve
Top achievements
Rank 2
Veteran
answered on 16 Sep 2011, 02:45 AM
Have a peekeroo over here

multiPage.get_pageViews().getPageView(index).set_contentUrl("http://www.google.com");
...so this changes the value CLIENT side...

If you want to change it Serverside, it's the ContentUrl Property you want to look at :)

Cheers,
Steve
0
Kevin
Top achievements
Rank 2
answered on 19 Sep 2011, 01:32 PM
Hello Rohit,

Just to add to Steve's point, you'll need to use the ContentUrl property of the RadPageView and not add iFrames to your RadPageView, as the RadPageView will build the iFrame based on the url.
0
Rohit
Top achievements
Rank 1
answered on 19 Sep 2011, 09:38 PM
Hi Kevin,

Can you please demonstrate the use of SetContentUrl property with an example?

I am trying to use the following:
RadMultiPage1.PageViews[1].

Where -- RadMutltiPage1 is my RadMultiPage ID & RadPageView2 is the my RadPageView ID.

When I type a '.' (dot) after 'RadMultiPage1.PageViews[1]'...... I do not see a ContentUrl property :-( 
I was expecting.... something on the lines of 'RadMultiPage1.PageViews[1].ContentUrl("Admin.aspx");'

Can someone please help me here.....

Thanks a lot in advance,
Rohit

 
0
Kevin
Top achievements
Rank 2
answered on 20 Sep 2011, 12:51 PM
Hello Rohit,

What version of the controls are you using? I'm using the latest version 2011.2.712 and the ContentUrl property shows up. It's exactly as you posted:

RadMultiPage1.PageViews[0].ContentUrl = "Some Url";
0
Rohit
Top achievements
Rank 1
answered on 20 Sep 2011, 08:20 PM
Hi Kevin,

My company purchased the controls back in 2009 and I am using the same controls that we downloaded then.

Is there a way I can upgrade my controls to the latest version?

If the answer is yes.. do I have to re-setup my project... or can I run a script that would automatically upgrade the controls that I am currently using in my project to the latest version?

Thanks in advance for your help.

Regards,
Rohit
0
Dimitar Terziev
Telerik team
answered on 21 Sep 2011, 12:28 PM
Hello Rohit,

Please refer to the following KB giving information how to upgrade your controls.

All the best,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
TabStrip
Asked by
Rohit
Top achievements
Rank 1
Answers by
Steve
Top achievements
Rank 2
Veteran
Kevin
Top achievements
Rank 2
Rohit
Top achievements
Rank 1
Dimitar Terziev
Telerik team
Share this question
or