Data transfer between asp.net file upload and refresh and asp.net page and iframe

  • 2020-05-07 19:29:03
  • OfStack

Specific we how to realize the asynchronous file refresh, there have been many articles on the Internet to solve this problem, but will use a lot of javascript, because I am coding capability, so today not hd why them, but they seem to use in the solution to the iframe, this let me..., so I just talk about with this processing refresh the train of thought.

Often is in the first one is the actual page there'll be more content, for the time being, we can divide it into A, B two area, A area is the content area, we can use updatepanel to implement asynchronous refresh, B areas is the upload area, we have used div ifame placeholder, including specific function to realize we can upload into C page, so that when click the refresh button B area, we can show the C page spread value to update the content of the inside, when we click the button to delete or save the same content, You can also get the contents of the C page, which basically satisfies the no-refresh feeling.


In fact, this method can not be called asynchronous refresh, because we only use iframe to achieve the local refresh of the page to satisfy a feeling of no refresh.


If you do this, the pass-through between the asp.net page and iframe page will become another problem. Actually, this problem is easier if you know it, but if you don't know it, you don't know where to start.
There are probably a lot of options available on the web for handling transfers, but I used javascript to get the control and get the values it contains.


This is to get the iframe f1, and the img control in the C page
var objFrame = document.getElementById("f1");
var objPicture = objFrame.contentWindow.document.getElementById("imgPicture");

Of course, you can also get the parent page control in C to get the value
var objHid = this.parent.document.getElementById("")


This is div with ifrmae
< div id="iconpicture" >
< iframe id="f1" style="width: 300px; height: 300px" src="UploadImage.aspx" scrolling="no"
frameborder="0" border="0" frameborder="no" > < /iframe >
< /div >


I've used this approach successfully in my projects, but the main difficulty with this approach is not the implementation of specific functions, but the adaptation of page layout in multiple browsers. Of course the javascript I provide is for multi-browser.

Related articles: