Spellchecker not working within asp:UpdatePanel and another Panel where the visibility="false"

Last post 03-30-2010, 10:32 PM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  03-29-2010, 5:45 AM 59707

    Spellchecker not working within asp:UpdatePanel and another Panel where the visibility="false"

    I have embedded the editor into an UpdatePanel and then into another panel where the panel's visibility is false.  But when a user clicks a button to show that panel (and the editor contained within it) the spell checker button returns a javascript error saying "Object doesn't support this property or method"
     
    If I remove the editor from the panel it works fine in the UpdatePanel it just seems to be something to do with changing the visibility of the panel within an UpdatePanel which causes the error to occur.
     
    Does anyone have a work around for this?
     
    Attached is a basic example on how to replicate the problem
     
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
    <%
    @ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
    <%
    @ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <
    head runat="server">
    <title></title>
    </
    head>
    <
    body>
    <form id="form1" runat="server">
     
    <ajaxToolkit:ToolkitScriptManager runat="Server" ID="ScriptManager1" />

    <asp:UpdatePanel ID="EditUpdPnl" runat="server">

    <ContentTemplate>

    <asp:Panel ID="TestPnl" runat="server" Visible="false">

    <CE:Editor ID="Editor1" runat="server" />

    </asp:Panel>

    <asp:LinkButton ID="LinkButton1" runat="server" OnClick="ShowPanel">Show</asp:LinkButton>

    </ContentTemplate>

    </asp:UpdatePanel>

    </div>

    </form>

    </body>

    </html>


    And the code behind


    Partial Class _Default

    Inherits System.Web.UI.Page

     

    Sub ShowPanel(ByVal sender As Object, ByVal e As EventArgs)

    TestPnl.Visible = "True"

    End Sub

    End Class

     

     

  •  03-30-2010, 10:32 PM 59755 in reply to 59707

    Re: Spellchecker not working within asp:UpdatePanel and another Panel where the visibility="false"

    Hi mokeyb ,
     
    Try this way
    1. <%@ Page Language="VB" AutoEventWireup="false" %>   
    2.   
    3. <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>   
    4. <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>   
    5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
    6.   
    7. <script runat="server">   
    8.     Public loaderName As String  
    9.     Protected Overloads Overrides Sub OnInit(ByVal e As EventArgs)   
    10.         MyBase.OnInit(e)   
    11.         Dim browser As System.Web.HttpBrowserCapabilities = Request.Browser   
    12.         Dim browserName As String = browser.Browser   
    13.        
    14.         Select Case browserName   
    15.             Case "IE"  
    16.                 loaderName = "IE_Loader"  
    17.                 Exit Select  
    18.             Case "Firefox"  
    19.                 loaderName = "Gecko_Loader"  
    20.                 Exit Select  
    21.             Case "AppleMAC-Safari"  
    22.                 loaderName = "Safari_Loader"  
    23.                 Exit Select  
    24.             Case "Opera"  
    25.                 loaderName = "Opera_Loader"  
    26.                 Exit Select  
    27.             Case Else  
    28.                 Exit Select  
    29.            
    30.         End Select  
    31.     End Sub  
    32.     Protected Sub LinkButton1_Click(ByVal sender As ObjectByVal e As System.EventArgs)   
    33.         TestPnl.Visible = True  
    34.     End Sub  
    35. </script>   
    36.   
    37. <script src="CuteSoft_Client/CuteEditor/Scripts/spell.js"></script>   
    38.   
    39. <script src="CuteSoft_Client/CuteEditor/Scripts/<%=loaderName %>/Loader.js"></script>   
    40.   
    41. <html xmlns="http://www.w3.org/1999/xhtml">   
    42. <head id="Head1" runat="server">   
    43.     <title></title>   
    44. </head>   
    45. <body>   
    46.     <form id="form1" runat="server">   
    47.     <div>   
    48.         <ajaxToolkit:ToolkitScriptManager runat="Server" ID="ScriptManager1" />   
    49.         <asp:UpdatePanel ID="EditUpdPnl" runat="server">   
    50.             <ContentTemplate>   
    51.                 <asp:Panel ID="TestPnl" runat="server" Visible="false">   
    52.                     <CE:Editor ID="Editor1" runat="server" />   
    53.                 </asp:Panel>   
    54.                 <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">Show</asp:LinkButton>   
    55.             </ContentTemplate>   
    56.         </asp:UpdatePanel>   
    57.     </div>   
    58.     </form>   
    59. </body>   
    60. </html>  
    Regards,
     
    ken
View as RSS news feed in XML