RichEditingIsAvailable is Always False

Last post 10-02-2006, 12:14 PM by Adam. 13 replies.
Sort Posts: Previous Next
  •  09-04-2006, 11:40 AM 22329

    RichEditingIsAvailable is Always False

    CuteEditor always appears as a textarea with no toolbars or richtext options. While trying to get to the bottom of this I've noticed that the property RichEditingIsAvailable is False. This has been tested on WinXP SP2, IE6 and IE7 RC1 and EnableClientScript returns True on all machines tested.
     
    Interestingly this only occurs when I'm adding the Editor in the code behind page. If I add it as a control in the designer it works fine but when adding it from the pagebehind file it only generates the textarea.
     
    My CodeBehind code:
     

    Protected WithEvents re As New CuteEditor.Editor

     

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    AddEditor()

    End Sub

    Sub AddEditor()

    Response.Write("Text Before Editor. ")

    ShowAnEditor()

    Response.Write("<br>Text After Editor")

    End Sub

    Private Sub ShowAnEditor()

    Dim SB As New System.Text.StringBuilder

    Dim SW As New StringWriter(SB)

    Dim htmlTW As New HtmlTextWriter(SW)

    re.ID = "editor"

     

    re.RenderBeginTag(htmlTW)

    re.RenderControl(htmlTW)

    re.RenderEndTag(htmlTW)

    response.Write(SB.ToString())

    End Sub

     
     
    Any answers?
  •  09-04-2006, 12:22 PM 22332 in reply to 22329

    Re: RichEditingIsAvailable is Always False

    mike_f1:
    CuteEditor always appears as a textarea with no toolbars or richtext options. While trying to get to the bottom of this I've noticed that the property RichEditingIsAvailable is False. This has been tested on WinXP SP2, IE6 and IE7 RC1 and EnableClientScript returns True on all machines tested.
     
    Interestingly this only occurs when I'm adding the Editor in the code behind page. If I add it as a control in the designer it works fine but when adding it from the pagebehind file it only generates the textarea.
     
    My CodeBehind code:
     

    Protected WithEvents re As New CuteEditor.Editor

     

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    AddEditor()

    End Sub

    Sub AddEditor()

    Response.Write("Text Before Editor. ")

    ShowAnEditor()

    Response.Write("<br>Text After Editor")

    End Sub

    Private Sub ShowAnEditor()

    Dim SB As New System.Text.StringBuilder

    Dim SW As New StringWriter(SB)

    Dim htmlTW As New HtmlTextWriter(SW)

    re.ID = "editor"

     

    re.RenderBeginTag(htmlTW)

    re.RenderControl(htmlTW)

    re.RenderEndTag(htmlTW)

    response.Write(SB.ToString())

    End Sub

     
     
    Any answers?
     
    mike_f1,
     
    Please try the following code:
     
        Protected WithEvents re As CuteEditor.Editor
        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            If Not Page.IsPostBack Then
                re="Hello world"
            End If
        End Sub

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  09-05-2006, 3:40 AM 22346 in reply to 22332

    Re: RichEditingIsAvailable is Always False

    Hi Adam,
     
    Thanks for your reply. I've had to change your code a little as it was producing errors. I changed:
     
    Protected WithEvents re As CuteEditor.Editor
     
    to
     
    Protected WithEvents re As New CuteEditor.Editor
     
    as it was giving an object reference error.
    I also changed:
     
    re = "Hello world"
     
    to
     
    re.Text = "Hello world"
     
    as it was giving error statiung that Value of type string cannot be converted to type CuteEditor.Editor. The end result was the Hello World text being displayed in the textarea but RichEditing is still false.
     
    Any further ideas or tests?
     
    Mike
  •  09-05-2006, 12:11 PM 22351 in reply to 22346

    Re: RichEditingIsAvailable is Always False

    Mike,
     
    Can you post the aspx which inherited this code-behind file?
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  09-06-2006, 3:42 AM 22399 in reply to 22351

    Re: RichEditingIsAvailable is Always False

    this is the basic aspx page I'm using just to try and get it to work (note: In the codebehind file I have also tried the line label1.text = sb.ToString instead of response.write(sb.ToString) both have the same effect):
     
     
    <%@ Register TagPrefix="ce" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <%@  Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="cute.WebForm1" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>cute editor test</TITLE>
    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
     
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <asp:label id="Label1" style="Z-INDEX: 102; LEFT: 40px; POSITION: absolute; TOP: 128px" runat="server" Width="480px" Height="120px">
     
    </BODY>
    </HTML>
  •  09-06-2006, 12:13 PM 22410 in reply to 22399

    Re: RichEditingIsAvailable is Always False

    mike_f1,
     
    Even you add CuteEditor Register directive at the top of your aspx page, you forget to add the CuteEditor tags in the body of the WebForm.
     
    <CE:Editor id="Editor1" runat="server" ></CE:Editor>
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  09-07-2006, 6:00 AM 22477 in reply to 22410

    Re: RichEditingIsAvailable is Always False

    Adam,
     
    If I add the line you suggest then the editor does display as you say but this is not the issue. I am trying to get the editor to display from the code-behind file and not in the HTML itself.
     
    I'm pressuming this is possible?
     
    Mike
     
  •  09-11-2006, 11:46 AM 22591 in reply to 22477

    Re: RichEditingIsAvailable is Always False

    Adam,
     
    Any news on this problem yet? It needs to be 100% from the code behind page. I'm pressuming that this is possible?
     
    Thanks,
     
    Mike
  •  09-11-2006, 12:44 PM 22593 in reply to 22591

    Re: RichEditingIsAvailable is Always False

    Mike,
     
     
    Source code:
     
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor"%>
    <%@ Page Language="C#" ValidateRequest="False"%>
       <body>
      <form runat="server">
       <h4>How many Editors would you like to create? (<i>Please choose vaule between 1 and 10</i>)</h4>
       <hr>
       <asp:textbox runat="Server" id="txtTBCount" Columns="3" />
       <asp:RangeValidator runat="server" ControlToValidate="txtTBCount"
         MinimumValue="1" MaximumValue="10" Type="Integer"
         ErrorMessage="Make sure that you choose a value between 1 and 10!" ID="Rangevalidator1" NAME="Rangevalidator1"/>
       <br />
       <asp:button runat="server" Text="Create Dynamic Editors" OnClick="CreateEditors" ID="Button1" NAME="Button1"/>
       <p>
        <asp:PlaceHolder runat="server" id="EditorsHere" />
       </p>
      </form>
      <script runat="server">
      
       int count = 1;
         
       void IterateThroughChildren(Control parent)
       {
        foreach (Control c in parent.Controls)
        {
         if (c.GetType().ToString().Equals("CuteEditor.Editor") &&
          c.ID == null)
         {
         ((CuteEditor.Editor) c).Text = "Editor " + count.ToString();
         ((CuteEditor.Editor) c).AutoConfigure  = AutoConfigure.Simple;
         ((CuteEditor.Editor) c).Height  = 200;    
         ((CuteEditor.Editor) c).ThemeType  = ThemeType.Office2003_BlueTheme;
         
         count++;
         }
              
         if (c.Controls.Count > 0)
         {         
          IterateThroughChildren(c);         
         }
        }
       }
       void CreateEditors(Object sender, EventArgs e)
       {
        if (!Page.IsValid) return;
            
        int n = Int32.Parse(txtTBCount.Text);
            
        // now, create n Editors, adding them to the PlaceHolder EditorsHere
        for (int i = 0; i < n; i++)
        {
         EditorsHere.Controls.Add(new CuteEditor.Editor());
        }
            
        // now, set the Text property of each CuteEditor.Editor
        IterateThroughChildren(this);
       }
      </script>
     </body>
    </HTML>

    Hope it helps.

    Let me know if you have any further questions.



    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  09-27-2006, 3:06 AM 23107 in reply to 22593

    Re: RichEditingIsAvailable is Always False

    Hi Adam,
     
    Sorry for a late reply, I was called to some other projects. This code seems to work but this is not what I am after. Our application must be able to display an editor from the code-behind file and not from within the html page.
     
    Any suggestions?
     
    Mike
  •  10-02-2006, 10:34 AM 23284 in reply to 23107

    Re: RichEditingIsAvailable is Always False

    Any suggestions with this anyone?
     
    I need a solution ASAP
  •  10-02-2006, 10:44 AM 23285 in reply to 23107

    Re: RichEditingIsAvailable is Always False

    mike_f1:
    Hi Adam,
     
    Sorry for a late reply, I was called to some other projects. This code seems to work but this is not what I am after. Our application must be able to display an editor from the code-behind file and not from within the html page.
     
    Any suggestions?
     
    Mike
     
    Mike,
     
    Just move the following code into your aspx code-behind file:
     
    <script runat="server">
      
       int count = 1;
         
       void IterateThroughChildren(Control parent)
       {
        foreach (Control c in parent.Controls)
        {
         if (c.GetType().ToString().Equals("CuteEditor.Editor") &&
          c.ID == null)
         {
         ((CuteEditor.Editor) c).Text = "Editor " + count.ToString();
         ((CuteEditor.Editor) c).AutoConfigure  = AutoConfigure.Simple;
         ((CuteEditor.Editor) c).Height  = 200;    
         ((CuteEditor.Editor) c).ThemeType  = ThemeType.Office2003_BlueTheme;
         
         count++;
         }
              
         if (c.Controls.Count > 0)
         {         
          IterateThroughChildren(c);         
         }
        }
       }
       void CreateEditors(Object sender, EventArgs e)
       {
        if (!Page.IsValid) return;
            
        int n = Int32.Parse(txtTBCount.Text);
            
        // now, create n Editors, adding them to the PlaceHolder EditorsHere
        for (int i = 0; i < n; i++)
        {
         EditorsHere.Controls.Add(new CuteEditor.Editor());
        }
            
        // now, set the Text property of each CuteEditor.Editor
        IterateThroughChildren(this);
       }
      </script>

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  10-02-2006, 11:48 AM 23291 in reply to 23285

    Re: RichEditingIsAvailable is Always False

    Playing around with this code, I can get it to work but the editor needs to be displayed from a DLL in the code-behind file. Is there a way in which the html can be produced and sent to the page with a response.write() command or something similar?
     
  •  10-02-2006, 12:14 PM 23292 in reply to 23291

    Re: RichEditingIsAvailable is Always False

    mike_f1,
     
    Glad to know you got it working.
     
    >>Is there a way in which the html can be produced and sent to the page with a response.write() command or something similar?
     
    This feature is not supported yet.
     
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View as RSS news feed in XML