referencing cutesoft Editor from pageName.aspx.cs

Last post 10-15-2010, 9:47 AM by Eric. 1 replies.
Sort Posts: Previous Next
  •  10-15-2010, 7:35 AM 64442

    referencing cutesoft Editor from pageName.aspx.cs

    All
     
    am new to CuteSoft, please pardon if this is too simple, or often asked, question on this forum.
     
    I have added following tag to the pageName.aspx file
     

         <CE:Editor id="Editor1" runat="server" />

    Am trying to change the text to a string retrieve from the database in the  Page_Load(object sender, EventArgs e) which is coded in the pageName.aspx.cs file. But variable Editor1 is not visible in that method. I get an error

       The name 'Editor1' does not exist in the current context. 
     
    The line I *THINK* should work is
     
              Editor1.Text = ValueObject.GetLetterText();
     
    Any help appreciated.
     
    Yazar
     
  •  10-15-2010, 9:47 AM 64445 in reply to 64442

    Re: referencing cutesoft Editor from pageName.aspx.cs

    Dear Yazar,
     
    Please refer to the following code:
     
    PutCodeDifferentFile.aspx:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="PutCodeDifferentFile.aspx.cs" Inherits="PutCodeDifferentFile" %>
    <%@ Register assembly="CuteEditor" namespace="CuteEditor" tagprefix="CE" %>
    <!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>    
            <CE:Editor ID="Editor1" runat="server">
            </CE:Editor>
         <asp:Button id="btnUpdate" onclick="Submit" Runat="server" Text="Show HTML"></asp:Button>
          <asp:Literal ID="Literal1" Runat="server" />
        </div>
        </form>
    </body>
    </html>
     
    PutCodeDifferentFile.aspx.cs
    using System;
    using System.Collections.Generic;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    public partial class PutCodeDifferentFile : System.Web.UI.Page
    {
        void Page_Load(object sender, System.EventArgs e)
      {
         if (IsPostBack)
      {
       Literal1.Text = "<h2>The HTML you typed is...</h2><br>";
       Literal1.Text += Server.HtmlEncode(Editor1.Text);
         }
      else
      {
    //   Editor1.Text = "Type Here";
       Editor1.Text = @"<table cellspacing=""4"" cellpadding=""4"" bgcolor=""#ffffff"" border=""0""> <tbody> <tr> <td> <p> <img src=""http://cutesoft.net/Uploads/j0262681.jpg"" width=""80"" alt=""""/></p></td> <td> <p>When your algorithmic and programming skills have reached a level which you cannot improve any further, refining your team strategy will give you that extra edge you need to reach the top. We practiced programming contests with different team members and strategies for many years, and saw a lot of other teams do so too.  </p></td></tr> <tr> <td> <p>  <img src=""http://cutesoft.net/Uploads/PH02366J.jpg"" width=""80"" alt="""" /></p></td> <td> <p>From this we developed a theory about how an optimal team should behave during a contest. However, a refined strategy is not a must: The World Champions of 1995, Freiburg University, were a rookie team, and the winners of the 1994 Northwestern European Contest, Warsaw University, met only two weeks before that contest.  </p></td></tr></tbody></table> <br /> <br />";
      }  
     }
     public void Submit(object sender, System.EventArgs e)
     {
      Literal1.Text = "<h2>The HTML you typed is...</h2><br>";
      Literal1.Text += Server.HtmlEncode(Editor1.Text);
     }
    }
    Thank you for asking
View as RSS news feed in XML