CE:Editor updating another CE:Editor in an UpdatePanel

  •  10-25-2013, 12:15 PM

    CE:Editor updating another CE:Editor in an UpdatePanel

    We have a scenario where a CE:Editor control is used to save rich text content to another CE:Editor control on the same page.  (Imagine a CE:Editor control adding a row of rich content to a gridview of other CE:Editors, where on the row level that text can be edited).  I would like for this to be done in ajax.  What is happening is that a full postback, or at least the page is being refreshed when the button is pressed.  Here is a simple example, modified from the AjaxSupport example.  The Lorem ipsum text is only there to make the page scrollable.  You will see that when you press the button, the page is refreshed back to the top.

     

    Is there any solution here? 

     

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>


    <!DOCTYPE html>


    <script runat="server">


        protected void Button1_Click(object sender, EventArgs e)

        {

            Editor2.Text = "Refreshed at " +

                DateTime.Now.ToString() + ": '" + Editor1.Text + "'";

        }

    </script>


    <html>

        <head>

                <title>ASP and ASP.NET WYSIWYG Editor - Ajax Support</title>

                <style type="text/css">

                #UpdatePanel1 { 

                width:760px;

                }

                </style>

          </head>

          <body>

            <form runat="server">

                      <table>

                            <tr>

                                  <td valign="top" width="760">

                                        <asp:ScriptManager ID="ScriptManager1" runat="server">

                                        </asp:ScriptManager>

                                        <h1>Ajax Support Sample</h1>

                            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque pellentesque magna vitae lectus interdum, commodo vulputate ante porttitor. Donec imperdiet ipsum sed mi venenatis facilisis. Quisque posuere metus dui, sit amet imperdiet tortor iaculis eget. Donec in adipiscing ante. Quisque sit amet nulla nec mauris consequat ultrices. Suspendisse neque velit, suscipit nec quam sit amet, dignissim fermentum elit. Praesent et mi quis arcu viverra mattis. Ut semper tempus elit, at adipiscing erat ultricies ac. Duis odio tortor, lobortis sollicitudin felis vel, tincidunt aliquam elit. Proin in semper nulla. Nullam convallis aliquet feugiat. Fusce sapien nisl, tempus at euismod nec, suscipit aliquet urna. Sed augue turpis, pellentesque in erat sit amet, dignissim hendrerit ipsum. Morbi rutrum elit nec tellus malesuada aliquam.</p>

                            <p>Ut et sem nec neque posuere ornare. Ut laoreet lectus non ultricies tempus. Morbi quis velit non urna commodo fringilla a ac lectus. Suspendisse leo orci, vulputate ut nisi non, mattis ultrices sapien. In volutpat ut nibh ac venenatis. Pellentesque non orci sed lacus accumsan aliquam ac consequat neque. Nunc scelerisque, est id suscipit luctus, purus eros lacinia libero, ut adipiscing mauris dolor a lacus. Mauris ultricies ipsum porta felis eleifend suscipit. Maecenas a mi tortor. Phasellus pretium sit amet odio non adipiscing.</p>

                            <p>Vivamus leo nibh, laoreet vitae sollicitudin in, viverra nec nisi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec nisl sem, euismod rhoncus ullamcorper nec, dignissim vitae nulla. Mauris consectetur diam nec venenatis facilisis. Nunc molestie bibendum ipsum. In non mollis dolor. Pellentesque eget feugiat ipsum, at sagittis purus. Aenean sodales felis in mollis porta. Sed eget metus rhoncus, bibendum neque id, gravida metus. Vivamus fermentum, dolor vitae posuere semper, nibh nulla consequat erat, sit amet suscipit sem velit ac nibh. Pellentesque non arcu id risus egestas suscipit. Vestibulum fringilla sollicitudin lacus, facilisis pulvinar lorem iaculis in.</p>

                            <p>Nullam in sagittis libero. Integer tortor tellus, accumsan ut faucibus ut, tristique sit amet felis. Sed ut dolor suscipit, tempus erat ultrices, pulvinar orci. Sed pretium non urna hendrerit ultrices. Donec eu erat id augue luctus tincidunt. Integer porttitor neque augue, in tincidunt velit blandit vitae. Curabitur consectetur est blandit sem luctus tincidunt. Ut nibh eros, luctus id malesuada sit amet, hendrerit et elit. Proin interdum id nisi ac eleifend. Ut in tellus ornare, euismod odio a, tincidunt ante. Nulla nec purus est.</p>

                            <p>Integer eget adipiscing massa. Sed auctor, nisi nec semper mattis, purus magna tristique turpis, nec lobortis metus libero id nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla porttitor, augue ac tempus volutpat, odio urna accumsan neque, quis consectetur nulla dolor viverra mauris. Vestibulum cursus dolor eget sodales dictum. Suspendisse neque odio, lobortis vitae adipiscing at, mattis sed lacus. Nulla vel condimentum risus. Etiam eleifend, augue a vulputate aliquet, sem ipsum pulvinar felis, eu accumsan mauris lacus egestas turpis. Vivamus a porttitor dui, vitae volutpat libero. Nullam feugiat justo vitae facilisis tristique. Donec aliquet eget dui id scelerisque. Suspendisse at odio gravida, cursus eros vel, fermentum sem. Suspendisse semper, arcu et tincidunt varius, urna mauris semper magna, nec mollis magna sem id turpis.</p>

                                        <br>

                                        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">

                                              <ContentTemplate>

                                                    <fieldset>

                                                    <legend>UpdatePanel</legend>

                                                    <asp:Label ID="Label1" runat="server" Text="Panel created."></asp:Label><br />

                                    <CE:Editor id="Editor2" AutoConfigure="Simple" runat="server"></CE:Editor>

                                                    </fieldset>

                                              </ContentTemplate>

                                              <Triggers>

                                                    <asp:AsyncPostBackTrigger ControlID="Button1" />

                                              </Triggers>

                                        </asp:UpdatePanel>

                                        <br>

                                                                            

                                        <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">

                                              <ContentTemplate>

                                                          <CE:Editor id="Editor1" AutoConfigure="Simple" runat="server" ></CE:Editor><br />

                                              </ContentTemplate>

                                        </asp:UpdatePanel>


                                        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />


                                  </td>

                            <tr>

                      </table>                  

                </form>

          </body>

    </html> 

View Complete Thread