This is a migrated thread and some comments may be shown as answers.

LoadRtfContent and FormView

4 Answers 11 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Edward
Top achievements
Rank 1
Edward asked on 11 Aug 2015, 03:14 PM

I put a RadEditor inside a Formview, which is inside a RadAjaxPanel.  I use the following to load RTF:

         protected void Unnamed_DataBinding(object sender, EventArgs e)

        {
            var txt = sender as RadEditor;

            txt.LoadRtfContent(@"{\rtf1\ansi\deff0
{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}
This line is the default color\line
\cf2
This line is red\line
\cf1
This line is the default color
}
");
        }

 The issue is the editor is displaying the text with HTML tags instead of formatted text.  I am wondering if this is an issue with the trial version (still waiting for my company to process the purchase) since it adds warning text to the content automatically.

4 Answers, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 13 Aug 2015, 11:00 AM
Hi Edward,

I was not able to reproduce the problem locally. Could you send me a sample page where I can actually see and debug the issue? Once I get it I will be able to advise you further.

There should be no problem with the trial version. Basically it is the same with the dev one.

Regards,
Stanimir
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Edward
Top achievements
Rank 1
answered on 13 Aug 2015, 01:50 PM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;

namespace Test
{
    public partial class Test4 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var d = new Dictionary<string, string>();
                d.Add("abc", "def");
                fv.DataSource = d;
                fv.DataBind();
            }
        }

        protected void Unnamed_DataBinding(object sender, EventArgs e)
        {
            var txt = sender as RadEditor;

            txt.LoadRtfContent(@"{\rtf1\ansi\deff0
{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}
This line is the default color\line
\cf2
This line is red\line
\cf1
This line is the default color
}
");
        }

        protected void Unnamed_Click(object sender, EventArgs e)
        {
            if (fv.CurrentMode == FormViewMode.ReadOnly)
                fv.ChangeMode(FormViewMode.Edit);
            else
                fv.ChangeMode(FormViewMode.ReadOnly);
        }
    }
}
0
Edward
Top achievements
Rank 1
answered on 13 Aug 2015, 01:51 PM
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test4.aspx.cs" Inherits="Test.Test4" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="~/Style/general.css" />
    <link rel="stylesheet" type="text/css" href="~/Style/sidemenu.css" />
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnableScriptCombine="false" ScriptMode="Release">
                <Scripts>
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
                    <asp:ScriptReference Path="~/Style/general.js" />
                </Scripts>
            </telerik:RadScriptManager>
            <div class="container">
                <div style="margin: 0px; width: 100%;" class="portfolio">
                    <div class="toplogobanner">
                        BANNER HERE
                    </div>
                    <div class="mainlayout">

                        <div class="leftmenu">
                            <div class="card">
                                Menu here
                            </div>
                        </div>

                        <div class="maincontent">
                            <div class="card">
                                <asp:Button runat="server" Text="switch" OnClick="Unnamed_Click" />

                                <asp:FormView runat="server" ID="fv">
                                    <ItemTemplate>
                                        <telerik:RadEditor ID="RadEditor1" runat="server" OnDataBinding="Unnamed_DataBinding" EnableTextareaMode="true" />
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <telerik:RadEditor ID="RadEditor1" runat="server" OnDataBinding="Unnamed_DataBinding" EnableTextareaMode="true" />
                                    </EditItemTemplate>
                                </asp:FormView>

                            </div>
                        </div>
                    </div>


                </div>
            </div>
            

        </telerik:RadAjaxPanel>
    </form>
</body>
</html>

0
Stanimir
Telerik team
answered on 14 Aug 2015, 11:03 AM
Hello,

Actually this is expected behavior because you set the EnableTextareaMode to true. In this case the content area of the control is textarea  and when its value is set with html it is rendered as plain text.


Regards,
Stanimir
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Editor
Asked by
Edward
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Edward
Top achievements
Rank 1
Share this question
or