I'm trying to build a very simple custom module using the Dynamicweb Editor control. I've created the MyModule custom module using the MyModule_Edit.aspx page. When adding the module to a paragraph and entering some text in the editor, this text is lost when I save the paragraph. Using the old UI solves this problem, but that's not a usable workaround. Here's my code:
MyModule_Edit.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyModule_Edit.aspx.cs" Inherits="CustomModules.MyModule_Edit" %>
<%@ Register Assembly="Dynamicweb.Controls" Namespace="Dynamicweb.Controls" TagPrefix="dw" %>
<dw:ModuleHeader ID="ModuleHeader1" runat="server" ModuleSystemName="MyModule" />
<dw:ModuleSettings ID="ModuleSettings1" ModuleSystemName="MyModule"
Value="HelloText,Description,SampleTemplate" runat="server" />
<dw:GroupBox ID="GroupBox1" runat="server" Title="Text">
<table style="width: 100%;">
<tr>
<td style="width: 170px;">Text</td>
<td><input id="HelloText" class="std" type="text" runat="server" /></td>
</tr>
<tr>
<td>Long text</td>
<td>
<dw:Editor ID="Description" runat="server" />
</td>
</tr>
<tr>
<td>Template file</td>
<td>
<dw:FileManager ID="SampleTemplate" Folder="Templates/MyModule" runat="server" />
</td>
</tr>
</table>
</dw:GroupBox>
MyModule_Edit.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Dynamicweb;
namespace CustomModules
{
public partial class MyModule_Edit : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Properties properties = Dynamicweb.Properties.LoadProperties();
properties.SetDefaultValue("SampleTemplate", "Template.html");
properties.SetDefaultValue("HelloText", "Default Hello Text");
properties.SetDefaultValue("Description", string.Empty);
Description.Text = properties.Values["Description"].ToString();
HelloText.Value = properties.Values["HelloText"].ToString();
SampleTemplate.File = properties.Values["SampleTemplate"].ToString();
}
}
}
It looks like a bug in the control to me, but if i'm missing something here I'd be glad to know. I hope you can help me with this.