PDA

View Full Version : [CLOSED] HtmlEditor value empty in DirectEvent



prost
May 16, 2014, 2:08 PM
Hi,

I've got a problem with the HtmlEditor. I need to store the text of a HtmlEditor in a DirectEvent. In the code sample below, it does matter which control calls the DirectEvent. When using the MenuItem, the Content.Text value is an empty string. The SplitButton will post the correct Text value.

I tested this with IE11 & Chrome. Ext.NET version: 2.5.1.25435

Do you have any idea why?
Regards,
Sander



<%@ Page Language="C#" %>

<script runat="server">


protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Content.Text = DateTime.Now.ToString();
}
}

public void SaveEntity(object sender, DirectEventArgs e)
{
var txt = Content.Text;
}


</script>


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Viewport ID="Viewport1" runat="server">
<Items>
<ext:FormPanel ID="MainPanel" runat="server">
<TopBar>
<ext:Toolbar ID="Toolbar1" runat="server">
<Items>
<ext:SplitButton runat="server" Text="Content is posted back" ID="SaveAndCloseButton" Icon="Disk">
<DirectEvents>
<Click OnEvent="SaveEntity" />
</DirectEvents>
<Menu>
<ext:Menu ID="Menu1" runat="server">
<Items>
<ext:MenuItem ID="SaveMenuItem" runat="server" Text="Content is NOT posted back" Icon="Disk">
<DirectEvents>
<Click OnEvent="SaveEntity" />
</DirectEvents>
</ext:MenuItem>
</Items>
</ext:Menu>
</Menu>
</ext:SplitButton>
</Items>
</ext:Toolbar>
</TopBar>
</ext:FormPanel>
<ext:HtmlEditor ID="Content" runat="server" Flex="1" />
</Items>
</ext:Viewport>
</form>
</body>
</html>

Daniil
May 16, 2014, 3:19 PM
Hi @prost,

Please set this for the Menu.

RenderToForm="true"

By default, a Menu is rendered outside a form.

prost
May 16, 2014, 3:23 PM
That worked... good to know...
Thanks