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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to display html File into IFrame--need urgent help [modified]

How to display html File into IFrame--need urgent help [modified]

Scheduled Pinned Locked Moved ASP.NET
helpjavahtmlsysadmintools
8 Posts 3 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.
  • V Offline
    V Offline
    Vishnu Narayan Mishra
    wrote on last edited by
    #1

    Hello every one There is little problem of IFrame, I have to show Html file in a IFrame, there is File upload control in the form, from there user browse a html file, I don't have to save the uploaded file, just I have to Save path of the uploaded file into an XML File. So I have to show the html file into IFrame by reading path from the XML and If user wants to show the newly uploaded file into IFrame then I have to also show uploaded file into IFrame without saving that uploaded. it will works well fine when I will save the file into server, but don't want to save the file and I have to save the file path into XML. So how can we assign 'src' of I Frame so that without saving the file.. Following code work well when I was displayed file into IFrame after saving it. Is there is any method through java script you know? .cs file protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { string path = System.IO.Path.Combine(Server.MapPath("~"),FileUpload1.FileName); FileUpload1.SaveAs(path); myIFrame.Attributes.Add("src", FileUpload1.FileName); } .aspx file

    -- modified at 2:07 Friday 23rd November, 2007

    V N 2 Replies Last reply
    0
    • V Vishnu Narayan Mishra

      Hello every one There is little problem of IFrame, I have to show Html file in a IFrame, there is File upload control in the form, from there user browse a html file, I don't have to save the uploaded file, just I have to Save path of the uploaded file into an XML File. So I have to show the html file into IFrame by reading path from the XML and If user wants to show the newly uploaded file into IFrame then I have to also show uploaded file into IFrame without saving that uploaded. it will works well fine when I will save the file into server, but don't want to save the file and I have to save the file path into XML. So how can we assign 'src' of I Frame so that without saving the file.. Following code work well when I was displayed file into IFrame after saving it. Is there is any method through java script you know? .cs file protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { string path = System.IO.Path.Combine(Server.MapPath("~"),FileUpload1.FileName); FileUpload1.SaveAs(path); myIFrame.Attributes.Add("src", FileUpload1.FileName); } .aspx file

      -- modified at 2:07 Friday 23rd November, 2007

      V Offline
      V Offline
      Vasudevan Deepak Kumar
      wrote on last edited by
      #2

      Vishnu Narayan Mishra wrote:

      So how can we assign 'src' of I Frame so that without saving the file..

      You can not. The SRC needs a file to load. And with security restrictions of loading across cross domains, it ought to be from the same domain/webserver.

      Vasudevan Deepak Kumar Personal Homepage
      Tech Gossips
      A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

      1 Reply Last reply
      0
      • V Vishnu Narayan Mishra

        Hello every one There is little problem of IFrame, I have to show Html file in a IFrame, there is File upload control in the form, from there user browse a html file, I don't have to save the uploaded file, just I have to Save path of the uploaded file into an XML File. So I have to show the html file into IFrame by reading path from the XML and If user wants to show the newly uploaded file into IFrame then I have to also show uploaded file into IFrame without saving that uploaded. it will works well fine when I will save the file into server, but don't want to save the file and I have to save the file path into XML. So how can we assign 'src' of I Frame so that without saving the file.. Following code work well when I was displayed file into IFrame after saving it. Is there is any method through java script you know? .cs file protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { string path = System.IO.Path.Combine(Server.MapPath("~"),FileUpload1.FileName); FileUpload1.SaveAs(path); myIFrame.Attributes.Add("src", FileUpload1.FileName); } .aspx file

        -- modified at 2:07 Friday 23rd November, 2007

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #3

        Vishnu Narayan Mishra wrote:

        I there is any metho through java script

        I don't think so. You can't load files to IFrame which is stored locally on users system. Have you tried getting the IFrame object through JS and setting the src with the file name specified ?

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

        V 1 Reply Last reply
        0
        • N N a v a n e e t h

          Vishnu Narayan Mishra wrote:

          I there is any metho through java script

          I don't think so. You can't load files to IFrame which is stored locally on users system. Have you tried getting the IFrame object through JS and setting the src with the file name specified ?

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

          V Offline
          V Offline
          Vishnu Narayan Mishra
          wrote on last edited by
          #4

          Yes i tried through java script function ShowPreview() { document.getElementById('htmlPreviewIFrame').src = GetClientSideControl(document, 'FileUpload').value; return false; } but it will work when the file exist in the web server project folder, i.e. in my project folder.

          N V 2 Replies Last reply
          0
          • V Vishnu Narayan Mishra

            Yes i tried through java script function ShowPreview() { document.getElementById('htmlPreviewIFrame').src = GetClientSideControl(document, 'FileUpload').value; return false; } but it will work when the file exist in the web server project folder, i.e. in my project folder.

            N Offline
            N Offline
            N a v a n e e t h
            wrote on last edited by
            #5

            Vishnu Narayan Mishra wrote:

            GetClientSideControl(document, 'FileUpload').value;

            Can you show the GetClientSideControl() function ?

            All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

            V 1 Reply Last reply
            0
            • V Vishnu Narayan Mishra

              Yes i tried through java script function ShowPreview() { document.getElementById('htmlPreviewIFrame').src = GetClientSideControl(document, 'FileUpload').value; return false; } but it will work when the file exist in the web server project folder, i.e. in my project folder.

              V Offline
              V Offline
              Vasudevan Deepak Kumar
              wrote on last edited by
              #6

              Vishnu Narayan Mishra wrote:

              GetClientSideControl

              Is this your own method in the page invoking some ActiveX OBJECT?

              Vasudevan Deepak Kumar Personal Homepage
              Tech Gossips
              A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

              V 1 Reply Last reply
              0
              • N N a v a n e e t h

                Vishnu Narayan Mishra wrote:

                GetClientSideControl(document, 'FileUpload').value;

                Can you show the GetClientSideControl() function ?

                All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

                V Offline
                V Offline
                Vishnu Narayan Mishra
                wrote on last edited by
                #7

                there is no issue regarding this GetClientSideControl() function,This function simply return id of any control. It is running successfully.It is not mandatory to use Iframe, we can also use any other control, do you know any other control? I am sending the GetClientSideControl() code.. Tell me soon...if you find the solution. function GetClientSideControl(document,ControlId) { var ctl; var d=document.all; var intLength=document.forms[0].length; var i=0; var id=''; for(i=0;i

                1 Reply Last reply
                0
                • V Vasudevan Deepak Kumar

                  Vishnu Narayan Mishra wrote:

                  GetClientSideControl

                  Is this your own method in the page invoking some ActiveX OBJECT?

                  Vasudevan Deepak Kumar Personal Homepage
                  Tech Gossips
                  A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

                  V Offline
                  V Offline
                  Vishnu Narayan Mishra
                  wrote on last edited by
                  #8

                  there is no issue regarding this GetClientSideControl() function,This function simply return id of any control. It is running successfully.It is not mandatory to use Iframe, we can also use any other control, do you know any other control? I am sending the GetClientSideControl() code.. Tell me soon...if you find the solution. function GetClientSideControl(document,ControlId) { var ctl; var d=document.all; var intLength=document.forms[0].length; var i=0; var id=''; for(i=0;i

                  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