Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Can I get a hold of ASP controls in an ASPX page

Can I get a hold of ASP controls in an ASPX page

Scheduled Pinned Locked Moved ASP.NET
comdesignsysadmin
8 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fiaolle
    wrote on last edited by
    #1

    Hi I have en Asp file lcon.asp in my website project, where I use an Iframe. I want to be able to use the iframe in the code behind from another aspx page.

    <iframe runat =server id="left" src="ShowGroups.aspx" scrolling="no" frameborder="0" width="100%" height="1000"></iframe>

    I would like to do something like this.

    protected System.Web.UI.HtmlControls.HtmlGenericControl frame1;
    HtmlControl frame1 = (HtmlControl)this.FindControl("left");
    frame1.Attributes["src"] = "http://search.msn.com";

    But if there is another way to refresh the iframe, please tell me. Fia

    F 1 Reply Last reply
    0
    • F fiaolle

      Hi I have en Asp file lcon.asp in my website project, where I use an Iframe. I want to be able to use the iframe in the code behind from another aspx page.

      <iframe runat =server id="left" src="ShowGroups.aspx" scrolling="no" frameborder="0" width="100%" height="1000"></iframe>

      I would like to do something like this.

      protected System.Web.UI.HtmlControls.HtmlGenericControl frame1;
      HtmlControl frame1 = (HtmlControl)this.FindControl("left");
      frame1.Attributes["src"] = "http://search.msn.com";

      But if there is another way to refresh the iframe, please tell me. Fia

      F Offline
      F Offline
      fiaolle
      wrote on last edited by
      #2

      I don't want to use javascript.

      A 1 Reply Last reply
      0
      • F fiaolle

        I don't want to use javascript.

        A Offline
        A Offline
        Abhishek Sur
        wrote on last edited by
        #3

        AFAIK ... no wayout other than javascript. At least the page should be posted back to the aspx page to get the iframe. You need to use custom handler to do this as your actual page is asp. Why dont you convert the asp page to aspx then.

        Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


        My Latest Articles-->** Simplify Code Using NDepend
        Basics of Bing Search API using .NET
        Microsoft Bing MAP using Javascript

        F 1 Reply Last reply
        0
        • A Abhishek Sur

          AFAIK ... no wayout other than javascript. At least the page should be posted back to the aspx page to get the iframe. You need to use custom handler to do this as your actual page is asp. Why dont you convert the asp page to aspx then.

          Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


          My Latest Articles-->** Simplify Code Using NDepend
          Basics of Bing Search API using .NET
          Microsoft Bing MAP using Javascript

          F Offline
          F Offline
          fiaolle
          wrote on last edited by
          #4

          Thank's for your answer, but I can't convert or not allowed to convert tha asp page to aspx. What do you mean by post back to the aspx page. And what is custom handler. Fia

          A 1 Reply Last reply
          0
          • F fiaolle

            Thank's for your answer, but I can't convert or not allowed to convert tha asp page to aspx. What do you mean by post back to the aspx page. And what is custom handler. Fia

            A Offline
            A Offline
            Abhishek Sur
            wrote on last edited by
            #5

            I mean say you have a page called submitRequest.aspx Now from your Asp page use: <form action ="submitRequest.aspx" > thus when the page is posted back it goes to submitRequest.aspx. You can get each of those form elements using Request object from submitRequest.aspx (even the IFrame) where page is your custom handler. You can also use a class which inherits from IHttpHandler to call its process request. On the other hand, how could you access the iframe from the server side, if your actual parent page is made using asp. You better use javascript to get reference from Iframe if you do require. I hope you got my point. :)

            Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


            My Latest Articles-->** Simplify Code Using NDepend
            Basics of Bing Search API using .NET
            Microsoft Bing MAP using Javascript

            F 1 Reply Last reply
            0
            • A Abhishek Sur

              I mean say you have a page called submitRequest.aspx Now from your Asp page use: <form action ="submitRequest.aspx" > thus when the page is posted back it goes to submitRequest.aspx. You can get each of those form elements using Request object from submitRequest.aspx (even the IFrame) where page is your custom handler. You can also use a class which inherits from IHttpHandler to call its process request. On the other hand, how could you access the iframe from the server side, if your actual parent page is made using asp. You better use javascript to get reference from Iframe if you do require. I hope you got my point. :)

              Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


              My Latest Articles-->** Simplify Code Using NDepend
              Basics of Bing Search API using .NET
              Microsoft Bing MAP using Javascript

              F Offline
              F Offline
              fiaolle
              wrote on last edited by
              #6

              Hi again I'm grateful for your answers, but I'm rather new to asp.net. How should I write to get a hold of the iframe. The iframe have id="left" in the asp page. But when I try Request["left"], I get null. And how am I going to change the src of the iframe. Hope you have time to help me more Fia

              A 1 Reply Last reply
              0
              • F fiaolle

                Hi again I'm grateful for your answers, but I'm rather new to asp.net. How should I write to get a hold of the iframe. The iframe have id="left" in the asp page. But when I try Request["left"], I get null. And how am I going to change the src of the iframe. Hope you have time to help me more Fia

                A Offline
                A Offline
                Abhishek Sur
                wrote on last edited by
                #7

                I think you need to use Javascript to communicate between the two pages, one the page that is loaded in iFrame and another is what is written in asp. If you can submit the asp page in a handler custom handler and access Request.Params to get the controls. :)

                Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


                My Latest Articles-->** Simplify Code Using NDepend
                Basics of Bing Search API using .NET
                Microsoft Bing MAP using Javascript

                F 1 Reply Last reply
                0
                • A Abhishek Sur

                  I think you need to use Javascript to communicate between the two pages, one the page that is loaded in iFrame and another is what is written in asp. If you can submit the asp page in a handler custom handler and access Request.Params to get the controls. :)

                  Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


                  My Latest Articles-->** Simplify Code Using NDepend
                  Basics of Bing Search API using .NET
                  Microsoft Bing MAP using Javascript

                  F Offline
                  F Offline
                  fiaolle
                  wrote on last edited by
                  #8

                  Hi again :) Do you have any code so I can see what I have to do. I don't know how to submit a page and I don't know how to use a custom handler. I have googled, but havent found anything I can use. Regards Fia

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups