Last post Jul 12, 2020 03:47 AM by zequion
Jul 11, 2020 05:42 AM|zequion|LINK
These are two buttons that each activate a Pdf that are displayed in an iframe, one on top of the other.
I am seeing that putting the second iframe with the Pdf in the same space of the first one, a RenderContents event of the first one occurs and it is eliminated.
Can 2 iframes be in the same place?
I need to prevent the second RenderContents from running automatically.
I have prevented it by code but it does not work because when you do not enter anything in the WebControl, it disappears.
I have 2 updatepanel and inside each one there is an ImageButton and a webcontrol with a "FilePath" Property. When clicking on the ImageButton, in codebehind in the RenderContents event, an iframe is entered
in the corresponding webcontrol. In the two iframe two different pdfs are shown and according to the "FilePath" property, an html iframe is generated to show the pdf or an empty iframe is generated if "FilePath" is = null.
The problem happens when I have already clicked on the first ImageButton and the iframe with the first Pdf is displayed. So if I click on the second ImageButto, the RenderContents event is generated and the second iframe is shown with the second Pdf on screen,
but then a RenderContents event is automatically generated for the first iframe that empties it of content.
iframes are displayed in the same space, one on top of the other.
Is that why you force to repaint the first iframe when loading the second one?
By having each webcontrol in a different updatepanel, I don't understand why the webcontrol from a different updatepanel is refreshed.
Also, I cannot use ViewState because the iframes are from a pdf where the user can go to the next page and the pdf would not be replaced as it was previously in the iframe, besides it works much slower.
<%@ Register Assembly="Cls_iFrameViewer" Namespace="Name_iFrameViewer" TagPrefix="cc1"%>
<div id="Form_Buscar_LayoutPanel" class="smart-pl1 Form_Buscar_LayoutPanel">
<!-- FIRST UPDATEPANEL -->
<asp:updatepanel ID="Form_UpdatePanel_Botones1" runat="server">
<div id="Form_Botones_Superior1" class="smart-pl1 Botones_Superior">
<span id="Form_PdfViewer_Button" runat="server" class="smart-pl1 Button_Visor">
<asp:ImageButton ID="Form_PdfViewer_Button_Image" runat="server" class="smart-pl1 Button_Visor_Image" ImageUrl="../images/cry/buscar/formatos/pdf.png" Visible="true"
OnClientClick="return Fcn_Visores_OnClient_Click(Name_Controles_Visores.Pdf, null, null);" OnClick="Fcn_AppVisores_Button_Click"/>
<cc1:iFrameViewer_Show ID="Form_PdfViewer" class="smart-pl1 pdfopen" runat="server" Cnt_Visor="Pdf"/>
<!-- SECOND UPDATEPANEL -->
<asp:updatepanel ID="Form_UpdatePanel_Botones2" runat="server">
<div id="Form_Botones_Superior2" class="smart-pl1 Botones_Superior">
<span id="Form_BrowserViewer_Button" runat="server" class="smart-pl1 Button_Visor">
<asp:ImageButton ID="Form_BrowserViewer_Button_Image" runat="server" class="smart-pl1 Button_Visor_Image" ImageUrl="../images/cry/buscar/formatos/web.png" Visible="true"
OnClientClick="return Fcn_Visores_OnClient_Click(Name_Controles_Visores.Browser, null, null);" OnClick="Fcn_AppVisores_Button_Click"/>
<cc2:iFrameViewer_Show ID="Form_BrowserViewer" class="smart-pl1 browseropen" runat="server" Cnt_Visor="Browser"/>
Jul 11, 2020 06:49 AM|KathyW|LINK
What does Fcn_AppVisores_Button_Click do? You are calling that same function in both buttons.
Jul 11, 2020 09:56 AM|zequion|LINK
Retrieves the name of the button pressed to execute the corresponding function.
Jul 11, 2020 10:58 AM|KathyW|LINK
Jul 11, 2020 11:09 AM|zequion|LINK
There are many unimportant lines of code.
What matters is that I am seeing that putting the second iframe with the Pdf in the same space of the first one, a RenderContents event of the first one occurs and it is eliminated.
Can 2 iframes be in the same place?
Jul 11, 2020 01:31 PM|KathyW|LINK
A description leaves only guessing, which is not helpful. There can be two iframes in the same page, but of course they can't be in the same place. What do you really mean by that? That's why I asked to see the code, to see what you are really doing. Feel free
to post a stripped down version, the minimum required to illustrate the problem you are having.
If you want to show only one iframe or the other, using buttons to flip back and forth, remove the one you are no longer showing before replacing it with the other. (Again, I'm having to guess what you are really trying to do.)
Jul 12, 2020 03:47 AM|zequion|LINK
I was able to fix this by using UpdateMode = "Conditional" in updatepanel.
This way the unwanted RenderContents event does not occur in the second updatepanel.