Welcome Guest Search | Active Topics | Sign In | Register

Saving editor content Options
mnorgate
Posted: Tuesday, November 2, 2010 1:15:43 PM
Rank: Newbie
Groups: Member

Joined: 11/2/2010
Posts: 5
I am having some problems with saving the changes made in the editor. I am working on an ASP.NET site and load HTML from a database into the editor for editing, I also have an ASP button at the bottom of the page to save, but when I click the button the changes are not passed through.

I'm a bit of a newbie with this so any code examples would be extreamly helpfull

Thanks
eo_support
Posted: Tuesday, November 2, 2010 1:57:26 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

There is nothing special about saving the HTML from an editor. You just get the Html property from the Editor and save it. The actual code is almost exactly the same as if you are saving the content of a standard ASP.NET TextBox control. The only difference is with ASP.NET TextBox control, you would use the "Text" property but with the Editor control you would use "Html" property. You can try to get your code working with the standard ASP.NET TextBox control first, then change it to the Editor control.

Thanks
mnorgate
Posted: Tuesday, November 2, 2010 3:02:47 PM
Rank: Newbie
Groups: Member

Joined: 11/2/2010
Posts: 5
That is what I have done I have the line of code Element1.html my problem is that this returns the same text I started with not the modified text
eo_support
Posted: Tuesday, November 2, 2010 3:17:41 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

That should not happen. Please try to isolate the problem into a test page and post the test page. Make sure the test page contains only code needed to reproduce the problem (for example, you should not include anything related to your database) and also runs independently. We will try to run the test page in our environment and as soon as we see the problem, we should be able to tell you why.

Thanks!
mnorgate
Posted: Tuesday, November 2, 2010 4:09:25 PM
Rank: Newbie
Groups: Member

Joined: 11/2/2010
Posts: 5
This is what I have for the test

Default.aspx
Code: HTML/ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="EditorTest.Default" %>

<%@ Register assembly="EO.Web" namespace="EO.Web" tagprefix="eo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <eo:Editor ID="Editor1" runat="server" Font-Bold="False" Font-Italic="False" 
            Font-Overline="False" Font-Strikeout="False" Font-Underline="False" 
            Height="320px" HighlightColor="255, 255, 192" ToolBarSet="Full" Width="500px">
            <HeaderStyle CssText="border-right: gray 1px solid; border-top: gray 1px solid; border-left: gray 1px solid; border-bottom: gray 1px" />
            <EditAreaStyle CssText="border-right: gray 1px solid; padding-right: 0px; border-top: gray 1px solid; padding-left: 0px; padding-bottom: 0px; border-left: gray 1px solid; padding-top: 0px; border-bottom: gray 1px solid" />
            <FooterStyle CssText="border-right: gray 1px solid; padding-right: 2px; border-top: gray 1px; padding-left: 2px; padding-bottom: 2px; border-left: gray 1px solid; padding-top: 2px; border-bottom: gray 1px solid; background-color: #fafafa" />
            <TabButtonStyles>
                <NormalStyle CssText="border-right: #335ea8 1px; padding-right: 7px; border-top: #335ea8 1px; padding-left: 7px; font-size: 12px; padding-bottom: 3px; border-left: #335ea8 1px; padding-top: 3px; border-bottom: #335ea8 1px; font-family: tahoma; background-color: white" />
                <HoverStyle CssText="border-right: #335ea8 1px solid; padding-right: 6px; border-top: #335ea8 1px solid; padding-left: 6px; font-size: 12px; padding-bottom: 2px; border-left: #335ea8 1px solid; padding-top: 2px; border-bottom: #335ea8 1px solid; font-family: tahoma; background-color: #c2cfe5" />
                <SelectedStyle CssText="border-right: #335ea8 1px solid; padding-right: 6px; border-top: #335ea8 1px solid; padding-left: 6px; font-size: 12px; padding-bottom: 2px; border-left: #335ea8 1px solid; padding-top: 2px; border-bottom: #335ea8 1px solid; font-family: tahoma; background-color: white" />
            </TabButtonStyles>
            <BreadcrumbLabelStyle CssText="padding-right: 6px; padding-left: 6px; font-size: 12px; padding-top: 1px; font-family: tahoma" />
            <BreadcrumbItemStyle CssText="border-right: darkgray 1px solid; padding-right: 3px; border-top: darkgray 1px solid; margin-top: 1px; padding-left: 3px; font-size: 12px; padding-bottom: 1px; border-left: darkgray 1px solid; padding-top: 1px; border-bottom: darkgray 1px solid; font-family: tahoma" />
            <BreadcrumbItemHoverStyle CssText="border-right: darkgray 1px solid; padding-right: 3px; border-top: darkgray 1px solid; margin-top: 1px; padding-left: 3px; font-size: 12px; padding-bottom: 1px; border-left: darkgray 1px solid; padding-top: 1px; border-bottom: darkgray 1px solid; font-family: tahoma; background-color:#e0e0e0;" />
            <BreadcrumbItemSeparatorStyle CssText="width: 3px; height: 10px" />
            <EmoticonDropDownStyle CssText="border-top: gray 1px solid; border-right: gray 1px solid; padding-right: 2px; border-top: gray 1px; padding-left: 2px; padding-bottom: 2px; border-left: gray 1px solid; padding-top: 2px; border-bottom: gray 1px solid; background-color: #fafafa" />
            <BreadcrumbDropDownStyle CssText="border-top: gray 1px solid; border-right: gray 1px solid; padding-right: 2px; border-top: gray 1px; padding-left: 2px; padding-bottom: 2px; border-left: gray 1px solid; padding-top: 2px; border-bottom: gray 1px solid; background-color: #fafafa" />
            <EmoticonStyle CssText="background-color:white;border-bottom-color:#c5d3ed;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#c5d3ed;border-left-style:solid;border-left-width:1px;border-right-color:#c5d3ed;border-right-style:solid;border-right-width:1px;border-top-color:#c5d3ed;border-top-style:solid;border-top-width:1px;padding-bottom:2px;padding-left:2px;padding-right:2px;padding-top:2px;" />
        </eo:Editor>
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Save" />
    
    </div>
    </form>
</body>
</html>


Code: C#
public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Editor1.Html = "Example Text";
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string editedText = Editor1.Html;
        }
    }


This is giving the same results, when the button is clicked no matter how I've changed the text the editedText string still equals "Example Text"
eo_support
Posted: Tuesday, November 2, 2010 4:53:24 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

That's because you are resetting it in every Page_Load. You should put your code inside If (!IsPostBack).

Thanks
mnorgate
Posted: Tuesday, November 2, 2010 5:01:29 PM
Rank: Newbie
Groups: Member

Joined: 11/2/2010
Posts: 5
Thank you


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.