auto sizing

Last post 10-06-2009, 3:51 PM by chuck7. 6 replies.
Sort Posts: Previous Next
  •  09-14-2009, 10:52 PM 55632

    auto sizing

    We have several cute editors on a page.  Some of them stand alone some and some are in a repeater control.  We want them all to expand to the correct size to display all the text (no scroll bars).  Unfortunately, some of the editors are collapsing to one line and have a vertical scroll bar.  All of the editors are configured the same.  How can we fix this?
     
     
  •  09-15-2009, 12:40 AM 55635 in reply to 55632

    Re: auto sizing

    HI chuck123,
     
    Please try this example
     
    1. <%@ Page Language="C#" %>   
    2.   
    3. <%@ Register Namespace="CuteEditor" Assembly="CuteEditor" TagPrefix="CE" %>   
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
    5.   
    6. <script runat="server">   
    7.     protected override void OnLoad(EventArgs e)   
    8.     {   
    9.         editor1.ResizeMode = CuteEditor.EditorResizeMode.AutoAdjust;   
    10.         base.OnLoad(e);   
    11.     }   
    12.       
    13. </script>   
    14.   
    15. <html xmlns="http://www.w3.org/1999/xhtml">   
    16. <head id="Head1" runat="server">   
    17.     <title>Untitled Page</title>   
    18. </head>   
    19. <body>   
    20.     <form id="form1" runat="server">   
    21.         <div>   
    22.             <CE:Editor ID="editor1" runat="server">   
    23.             </CE:Editor>   
    24.         </div>   
    25.     </form>   
    26. </body>   
    27. </html>   
    28.   
    29. <script type="text/javascript">   
    30. setInterval("refreshTime()",1000);   
    31.   
    32. function refreshTime()   
    33. {   
    34. var editor=document.getElementById('<%= editor1.ClientID%>');   
    35. var w=editor.GetDocument().body.scrollWidth;   
    36. if(w<760)w=760;   
    37. editor.style.width=w+10+"px";   
    38. }   
    39. </script>  
    Regards,
     
    Ken
  •  09-15-2009, 11:33 AM 55656 in reply to 55635

    Re: auto sizing

    Looks like a normal editor, about 15-20 rows shown, gets 10px wider every second.
  •  09-15-2009, 11:48 AM 55657 in reply to 55635

    Re: auto sizing

    The situation is the resizemode = autoadjust is intermittently failing.
     
    We have implemented multiple editors with a default height specified as well as the ResizeMode="AutoAdjust". The Default Height when defined alone will always be implemented and behaves as expected. When you introduce the ResizeMode="AutoAdjust" some controls will be a single line and others will take the default height. When a refresh is selected in the browser or the page is reloaded at times the AutoAdjust will be implemented and at times it will not.
  •  09-15-2009, 3:17 PM 55662 in reply to 55657

    Re: auto sizing

    After some testing it appears the editor may not like being wrapped within a table. The following code when first entering the page will show the problem we are experiencing. However, if we continue to refresh the page the text boxes will suddenly begin to autoadjust.
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
       
        <table>
            <tr>
               
                    <td align="top">
                    <div style="margin-right: 15px;">
                        <CE:Editor ID="Editor1" runat="server" />
                        <table>
                        <tr>
                        <td><CE:Editor ID="Editor2" runat="server" /></td>
                        <td><CE:Editor ID="Editor3" runat="server" /></td>
                        </tr>
                        </table>
                       
                       
                        <CE:Editor ID="Editor4" runat="server" />
                        <CE:Editor ID="Editor5" runat="server" />
                        <CE:Editor ID="Editor6" runat="server" />
                        <CE:Editor ID="Editor7" runat="server" />
                        <CE:Editor ID="Editor8" runat="server" />
                        <CE:Editor ID="Editor9" runat="server" />
                        <CE:Editor ID="Editor10" runat="server" />
                    </div></td>
                    </tr>
                    </table>
            <asp:Button ID="btnDisplay" runat="server" Text="Display"
                onclick="btnDisplay_Click" />
            <asp:Button ID="btnEdit" runat="server" Text="Edit" onclick="btnEdit_Click" />
     
        </form>
    </body>
    </html>
  •  09-15-2009, 4:01 PM 55665 in reply to 55662

    Re: auto sizing

      An example using Cutesoft example on Auto Adjusting Height to show our issue...

    <%@ Page Language="C#"%>
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <html>
        <head>
            <title>ASP and ASP.NET WYSIWYG Editor - Editor Auto Adjusting Height</title>
            <link rel="stylesheet" href="example.css" type="text/css" />
        </head>
        <body>
            <form id="Form1" runat="server">
                <table cellpadding="15">
                    <tr>
                        <td id="leftcolumn" width="160">
                                
                        </td>
                        <td>
                            <h1>Editor Auto Adjusting Height</h1>
                            This example shows how to use Editor.ResizeMode to make the Editor change it's height based on the content.
                            The Editor will now grow and shrink in height to match the content inside.
                            <br />                        
                            <asp:radiobuttonlist id="ResizeList" runat="server" autopostback="True" RepeatDirection="Horizontal" onselectedindexchanged="theme_Changed">
                                <asp:ListItem value="AutoAdjust"  Selected="True">AutoAdjust</asp:ListItem>
                                <asp:ListItem value="ResizeCorner">ResizeCorner</asp:ListItem>
                                <asp:ListItem value="PlusMinus">PlusMinus</asp:ListItem>
                                <asp:ListItem value="None">None</asp:ListItem>
                            </asp:radiobuttonlist>                        
                            <CE:Editor id="Editor1" EditorWysiwygModeCss="example.css" AutoConfigure="Simple" Height="200" ResizeMode="AutoAdjust" ThemeType="Office2007" runat="server"/> <br />
                            <table><tr><td><CE:Editor id="Editor2" EditorWysiwygModeCss="example.css" AutoConfigure="Simple" Height="200" ResizeMode="AutoAdjust" ThemeType="Office2007" runat="server"/> <br /></td>
                            <td><CE:Editor id="Editor3" EditorWysiwygModeCss="example.css" AutoConfigure="Simple" Height="200" ResizeMode="AutoAdjust" ThemeType="Office2007" runat="server"/> <br /></td></tr></table>
                            
                            
                            <CE:Editor id="Editor4" EditorWysiwygModeCss="example.css" AutoConfigure="Simple" Height="200" ResizeMode="AutoAdjust" ThemeType="Office2007" runat="server"/> <br />
                            <CE:Editor id="Editor5" EditorWysiwygModeCss="example.css" AutoConfigure="Simple" Height="200" ResizeMode="AutoAdjust" ThemeType="Office2007" runat="server"/> <br />
                            <CE:Editor id="Editor6" EditorWysiwygModeCss="example.css" AutoConfigure="Simple" Height="200" ResizeMode="AutoAdjust" ThemeType="Office2007" runat="server"/> <br />
                            
                            
                            <asp:Button id="btnUpdate" onclick="Submit" Runat="server" Text="Submit"></asp:Button>
                            <asp:Literal ID="Literal1" Runat="server" />
                        </td>
                    </tr>
                </table>            
            </form>
        </body>
    </html>

    <script runat="server">
        void Page_Load(object sender, System.EventArgs e)
         {
            if (IsPostBack)
            {
                Literal1.Text = "<h2>The HTML you typed is...</h2><br>";
                Literal1.Text += Server.HtmlEncode(Editor1.XHTML);
            }
            else
            {
                Editor1.Text = "This is some more test text.<br>This is some more test text.<br>This is some more test text.<br>This is some more test text.<br>This is some more test text.<br>This is some more test text.<br>This is some more test text.<br>";
            }
        
        }
        public void Submit(object sender, System.EventArgs e)
        {
            Literal1.Text = "<h2>The HTML you typed is...</h2><br>";
            Literal1.Text += Server.HtmlEncode(Editor1.XHTML);
        }
        
        private void theme_Changed(Object sender, EventArgs e)
        {
            switch(ResizeList.SelectedItem.Value)
            {
                case "AutoAdjust":
                    Editor1.ResizeMode = EditorResizeMode.AutoAdjust;
                    Editor1.Text = "Editor1.ResizeMode  = EditorResizeMode.AutoAdjust;";
                    break;
                case "ResizeCorner":
                    Editor1.ResizeMode = EditorResizeMode.ResizeCorner;
                    Editor1.Text = "Editor1.ResizeMode  = EditorResizeMode.ResizeCorner;";
                    break;
                case "PlusMinus":
                    Editor1.ResizeMode = EditorResizeMode.PlusMinus;
                    Editor1.Text = "Editor1.ResizeMode  = EditorResizeMode.PlusMinus;";
                    break;
                case "None":
                    Editor1.ResizeMode = EditorResizeMode.None;
                    Editor1.Text = "Editor1.ResizeMode  = EditorResizeMode.None;";
                    break;
            }    
            Editor1.Visible = true;    
                
        }
    </script>
  •  10-06-2009, 3:51 PM 56144 in reply to 55635

    Re: auto sizing

    Any update on getting the autosizing to work?
View as RSS news feed in XML