Problem in Chome when using nested updatepanel

Last post 12-24-2009, 7:24 AM by johnyM. 2 replies.
Sort Posts: Previous Next
  •  12-22-2009, 6:11 AM 57895

    Problem in Chome when using nested updatepanel

    Hi,
     
    I'm currently evaluating CuteEditor on my local machine.
    My page has two updatepanels. The first panel holds a few controls and a button to show the editor.
    The editor itself is in a second updatepanel, nested in the first updatepanel.
     
    All this is working great, exept in Google Chrome.
     
    When the page loads the first time I can call the control and use it, but when I hit a button to hide the cuteditor (set visibility of the div-container to false) I can't call it a second time. The second time it displays correctly but I can't type any text into it. I have this problem only in Google Chrome, in other browsers everything is working as it should.
     
    I'm currently using FreeTextbox on my site, but I was hoping to change to CuteEditor. Any ideas how to resolve this problem? 
  •  12-22-2009, 9:10 AM 57896 in reply to 57895

    Re: Problem in Chome when using nested updatepanel

    Dear johnyM,
     
    Can you post your code here? we need to reproduce it based on your code.
     
    Regards,
    Eric
  •  12-24-2009, 7:24 AM 57920 in reply to 57896

    Re: Problem in Chome when using nested updatepanel

    The page:
     
    1. <%@ Page Title="" Language="VB" MasterPageFile="~/orca.master" AutoEventWireup="false" CodeFile="gastboek.aspx.vb" Inherits="gastboek" %>  
    2. <%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>  
    3. <asp:Content ID="Content2" ContentPlaceHolderID="cph" Runat="Server">  
    4. <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">  
    5.     <ContentTemplate>  
    6.         <h3>Gastenboek</h3><br />  
    7.         <p>Voeg hieronder een nieuw bericht toe aan het gastenboek:</p>  
    8.         <asp:Button runat="server" ID="btn" Text="Show editor" />  
    9.         <asp:UpdatePanel runat="server" UpdateMode="Conditional">  
    10.             <ContentTemplate>  
    11.                 <div class="wrap">  
    12.                     <div class="overlay" id="overlayFtb" style="display:none;"></div>  
    13.                     <div id="thisFTB" class="popupFtb" runat="server" visible="false">  
    14.                         <div class="header2">  
    15.                             <asp:label ID="titlelabel" runat="server">Gastenboek.</asp:label>  
    16.                             <asp:ImageButton runat="server" ToolTip="Sluiten" ID="btncancel" ImageUrl="~/utilities/images/site/buttons/cancel-032x032.gif" />  
    17.                             <div class="clear"></div>  
    18.                         </div>  
    19.                         <div style="background-color:#9EBEF5; border:solid 2px #1E789A;">  
    20.                             <div id="dvonderwerp" style="margin:4px;" runat="server">  
    21.                                 <asp:label ID="lblonderwerp" runat="server" Text="Je naam:" style="float:left; margin-right:10px; font-weight:bold;"></asp:label>  
    22.                                 <asp:TextBox ID="txtonderwerp" runat="server" style="float:right; width:360px;"></asp:TextBox>  
    23.                                 <div class="clear"></div>  
    24.                             </div>  
    25.                             <div>  
    26.                                 <CE:Editor ID="Editor1" AutoConfigure="Minimal" Width="100%" ThemeType="Office2007" CustomCulture="nl-NL"  
    27.                                     AllowPasteHtml="false" EnableContextMenu="false" ShowBottomBar="false" runat="server"></CE:Editor>         
    28.                                 <asp:Button ID="btnsave" runat="server" Text="Opslaan" style="margin-left:2px;" />  
    29.                             </div>  
    30.                         </div>  
    31.                     </div>  
    32.                 </div>  
    33.             </ContentTemplate>  
    34.         </asp:UpdatePanel>  
    35.     </ContentTemplate>  
    36. </asp:UpdatePanel>  
    37. </asp:Content>  

    The Code-behind:
     
    1. Partial Class gastboek   
    2.     Inherits System.Web.UI.Page   
    3.     Public Sub showeditor()   
    4.         thisFTB.Visible = True  
    5.         Dim strscript As String = AppTools.Misc.GetOverLayScript("overlayFtb")   
    6.         ScriptManager.RegisterClientScriptBlock(MeMe.[GetType](), "str", strscript, False)   
    7.     End Sub  
    8.     Protected Sub btncancel_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btncancel.Click   
    9.         thisFTB.Visible = False  
    10.         ScriptManager.RegisterClientScriptBlock(MeMe.[GetType](), "str", AppTools.Misc.GetOverlayCloseScript, False)   
    11.     End Sub  
    12.     Protected Sub btnsave_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btnsave.Click   
    13.         Dim returnurl As String = Request.Url.AbsoluteUri   
    14.         Dim ipaddress As String  
    15.         ipaddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")   
    16.         If ipaddress = "" Or ipaddress Is Nothing Then  
    17.             ipaddress = Request.ServerVariables("REMOTE_ADDR")   
    18.         End If  
    19.         GuestBookAdd(txtonderwerp.Text, Editor1.Text, ipaddress)   
    20.         Response.Redirect(returnurl)   
    21.     End Sub  
    22.     Sub GuestBookAdd(ByVal afzender As StringByVal bericht As StringByVal ip As String)   
    23.         Dim conn As New System.Data.OleDb.OleDbConnection(AppTools.SQLInstr.GetConnString("dbgastenboek"))   
    24.         conn.Open()   
    25.         Dim sql As String = "INSERT INTO tblBerichten (afzender, bericht, ip) " _   
    26.                 & "VALUES (@afzender, @bericht, @ip)"  
    27.         Dim comm As New System.Data.OleDb.OleDbCommand(sql, conn)   
    28.         comm.Parameters.AddWithValue("@afzender", afzender)   
    29.         comm.Parameters.AddWithValue("@bericht", bericht)   
    30.         comm.Parameters.AddWithValue("@ip", ip)   
    31.         comm.ExecuteNonQuery()   
    32.         conn.Close()   
    33.         comm.Dispose()   
    34.         conn.Dispose()   
    35.     End Sub  
    36.     Protected Sub btn_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btn.Click   
    37.         showeditor()   
    38.     End Sub  
    39. End Class  
    The called functions (gets a javascriptstring based on the browser type):
    1. Public Shared Function GetOverLayScript(ByVal target As StringAs String  
    2.   
    3.     Dim strScript As String = String.Empty   
    4.   
    5.     If HttpContext.Current.Request.Browser.Type = "IE6" Or HttpContext.Current.Request.Browser.Type = "IE7" Then  
    6.   
    7.         strScript = "<script type='text/javascript' language='javascript'>" & _   
    8.             "function alertSize() {var myHeight = 0;" & _   
    9.             "if (typeof (window.innerHeight) == 'number')" & _   
    10.             "{myHeight = window.innerHeight;}" & _   
    11.             "else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))" & _   
    12.             "{myHeight = document.documentElement.clientHeight;}" & _   
    13.             "else if (document.body && (document.body.clientWidth || document.body.clientHeight))" & _   
    14.             "{myHeight = document.body.clientHeight;}return myHeight;}" & _   
    15.             "try{var mydiv = document.getElementById('overlaytrans');" & _   
    16.             "var h = alertSize();" & _   
    17.             "var h2 = document.getElementById('wrapper').offsetHeight + 166;" & _   
    18.             "if (h <= h2) { mydiv.style.height = h2 + 'px';}" & _   
    19.             "else { mydiv.style.height = h + 'px';}" & _   
    20.             "document.getElementById('" & target & "').style.height = (h2 - 166) + 'px';" & _   
    21.             "document.getElementById('" & target & "').style.display = '';" & _   
    22.             "mydiv.style.display = '';document.getElementById('header').style.zIndex='-1';}catch(err){}</script>"  
    23.     Else  
    24.   
    25.         strScript = "<script language='javascript' type='text/javascript'>" & _   
    26.             "function alertSize() {var myHeight = 0;if (typeof (window.innerWidth) == 'number') {myHeight = window.innerHeight;} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {myHeight = document.documentElement.clientHeight;} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {myHeight = document.body.clientHeight;}return myHeight;}" & _   
    27.             "var mydiv = document.getElementById('overlaytrans');" & _   
    28.             "var h = alertSize();" & _   
    29.             "var h2 = document.getElementById('wrapper').offsetHeight + 166;" & _   
    30.             "if (h <= h2) { mydiv.style.height = h2 + 'px'; }" & _   
    31.             "else { mydiv.style.height = '100%';}" & _   
    32.             "mydiv.style.display = '';</script>"  
    33.   
    34.     End If  
    35.   
    36.   
    37.     Return strScript   
    38.   
    39.   
    40. End Function  
    41.   
    42. Public Shared Function GetOverlayCloseScript() As String  
    43.     Dim s As String = "<script language='javascript'>document.getElementById('overlaytrans').style.display = 'none';"  
    44.     If HttpContext.Current.Request.Browser.Type = "IE7" Or HttpContext.Current.Request.Browser.Type = "IE6" Then s += "document.getElementById('header').style.zIndex='0';"  
    45.     s += "</script>"  
    46.     Return s   
    47.   
    48.   
    49.   
    50. End Function  
View as RSS news feed in XML