ASP.NET 3.5 and above only

Obout.Ajax.UI Controls - HTML Editor - Editor in obout Window

Edit content


Generates browser-independent

and standards-compliant HTML


Loads features on demand -- lightweight and fast


Fully customizable: external image galleries,

custom buttons, import/export content, templates


Integrates with grid, AJAXPage, flyout and other controls




ASP.NET
<%@ Register Assembly="Obout.Ajax.UI" Namespace="Obout.Ajax.UI.HTMLEditor" TagPrefix="obout" %>
<%@ Register TagPrefix="owd" Namespace="OboutInc.Window" Assembly="obout_Window_NET"%>
<obout:PopupHolder runat="server" id="popupHolder" DefaultAddPolicy="Demand" PopupsZIndex="200000" />
<asp:UpdatePanel ID="updatePanel1" runat="server">
<ContentTemplate>
<obout:Editor style="display:none" runat="server" Id="editor" Height="300px"
  Width="100%" PopupHolderID="popupHolder" />
<asp:LinkButton ID="LinkButton1" runat="server" Text="Edit content"
  OnClientClick="myWindow.Open(); return false;" />
<hr />
<asp:Label ID="ContentPanel" runat="server" />
<owd:Window runat="server" ShowMaximizeButton="true" Title="Edit" Overflow="HIDDEN" ID="myWindow"
  Width="800" Height="550" Left="200" Top="100" VisibleOnLoad="false"
  OnClientResize="windowResize();" OnClientOpen="windowOpen();"
  OnClientPreClose="return windowPreClose();"
  StyleFolder="../window/wdstyles/default" ShowStatusBar="true">
<asp:LinkButton runat="server" onclick="SubmitClick" Text="Save content" ID="Submit" />
<asp:LinkButton ID="CancelButton" runat="server" Text="Cancel" OnClientClick="return cancelPopup();" />
</owd:Window>
</ContentTemplate>
</asp:UpdatePanel>
...
<script type="text/javascript" >
  function pageLoad() {
     if (!Obout.Ajax.UI.HTMLEditor.AjaxPopupLoadingInProgress) {
        var editor = $get("<%= editor.ClientID %>");
        var submit = $get("<%= Submit.ClientID %>");
        submit.parentNode.insertBefore(editor, submit);
        editor.style.display = "";
        if (typeof myWindow != "undefined") {
            myWindow.Close();
        }
     }
  }

  function cancelPopup() {
     myWindow.Close();
     return false;
  }

  function windowResize() {
     var container = $get("<%= editor.ClientID%>");
     var submit = $get("<%= Submit.ClientID %>");
     if (submit.parentNode != container.parentNode) return;
     var step = 20;
     var temp;
     var innerTable = container.firstChild;

     while(innerTable.nodeType != 1 || innerTable.tagName.toUpperCase() != "TABLE") {
        innerTable = innerTable.nextSibling;
     }
     while ((temp = IsInScroll(container)) == 0) {
        innerTable.style.height = parseInt(innerTable.style.height) + step + "px";
     }
     innerTable.style.height = parseInt(innerTable.style.height) - temp + "px";
  }

  function IsInScroll(elem) {
     elem = elem.parentNode.parentNode;
     if (elem.clientHeight > 0 && elem.scrollHeight && elem.scrollHeight > 0) {
        if (elem.scrollHeight > elem.clientHeight) {
          return elem.scrollHeight - elem.clientHeight;
        }
     }
     return 0;
  }

  function windowOpen() {
     windowResize();
  }
  function windowPreClose() {
     if (Obout.Ajax.UI.HTMLEditor.DesignPanel.isPopup()) {
        setTimeout(function() { alert("Close Editor's popups!!!"); }, 0);
        return false;
     }
      return true;
  }
</script>

"Works like a charm! Not only did you give an excellent response to our problem, but your suggested solution also gave us a couple of other interesting tips! Thanks a lot!"

Asbjørn Kvalheim
Sense Data

Random testimonial   All testimonials