Programmatically change iframe's source

7 posts, 0 answers
  1. Rohit
    Rohit avatar
    4 posts
    Member since:
    Jul 2011

    Posted 15 Sep 2011 Link to this post

    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 !!
  2. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 15 Sep 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 19 Sep 2011 Link to this post

    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.
  5. Rohit
    Rohit avatar
    4 posts
    Member since:
    Jul 2011

    Posted 19 Sep 2011 Link to this post

    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

     
  6. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 20 Sep 2011 Link to this post

    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";
  7. Rohit
    Rohit avatar
    4 posts
    Member since:
    Jul 2011

    Posted 20 Sep 2011 Link to this post

    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
  8. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 21 Sep 2011 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017