| 1 | <%@ Page Language="C#" AutoEventWireup="true" %> |
|---|
| 2 | |
|---|
| 3 | <%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %> |
|---|
| 4 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 5 | <!-- |
|---|
| 6 | Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. |
|---|
| 7 | For licensing, see LICENSE.html or http://ckeditor.com/license |
|---|
| 8 | --> |
|---|
| 9 | <script runat="server"> |
|---|
| 10 | protected void CKEditor1_TextChanged(object sender, System.EventArgs e) |
|---|
| 11 | { |
|---|
| 12 | TextBox2.Text = CKEditor1.Text; |
|---|
| 13 | } |
|---|
| 14 | protected void TextBox3_TextChanged(object sender, System.EventArgs e) |
|---|
| 15 | { |
|---|
| 16 | TextBox4.Text = TextBox3.Text; |
|---|
| 17 | } |
|---|
| 18 | </script> |
|---|
| 19 | <html xmlns="http://www.w3.org/1999/xhtml"> |
|---|
| 20 | <head runat="server"> |
|---|
| 21 | <title>First Use — CKEditor for ASP.NET Sample</title> |
|---|
| 22 | <link href="sample.css" rel="stylesheet" type="text/css" /> |
|---|
| 23 | </head> |
|---|
| 24 | <body> |
|---|
| 25 | <form id="form1" runat="server"> |
|---|
| 26 | <h1 class="samples"> |
|---|
| 27 | CKEditor for ASP.NET Sample — Adding the CKEditor for ASP.NET Control to a Page |
|---|
| 28 | </h1> |
|---|
| 29 | <div class="description"> |
|---|
| 30 | <p> |
|---|
| 31 | If you want use the CKEditor for ASP.NET Control, you must add references to the project and |
|---|
| 32 | register the control.<br /> |
|---|
| 33 | If you only intend to use the control on a single page, you can add a <code>Register</code> |
|---|
| 34 | section to its source code: |
|---|
| 35 | </p> |
|---|
| 36 | <pre class="samples"><span style="background-color: #ffff00"><<font>%</font></span><span style="color: #0000ff">@</span><span style="color: #a52a2a">Register </span><span style="color: #ff0000">Assembly</span><span style="color: #0000ff">="CKEditor.NET" </span><span style="color: #ff0000">Namespace</span><span style="color: #0000ff">="CKEditor.NET" </span><span style="color: #ff0000">TagPrefix</span><span style="color: #0000ff">="CKEditor"</span><span style="background-color: #ffff00">%></span></pre> |
|---|
| 37 | <p> |
|---|
| 38 | If you intend to use the control on multiple pages, you can add the <code>Register</code> |
|---|
| 39 | section in <code>web.config</code>. Insert the following code into the <code><span style="color: #0000ff"><</span><span style="color: #a52a2a">system.web</span><span style="color: #0000ff">><</span><span style="color: #a52a2a">pages</span><span style="color: #0000ff">><</span><span style="color: #a52a2a">controls</span><span style="color: #0000ff">></span></code> section: |
|---|
| 40 | </p> |
|---|
| 41 | <pre class="samples"><span style="color: #0000ff"><</span><span style="color: #a52a2a">add </span><span style="color: #ff0000">tagPrefix</span><span style="color: #0000ff">="CKEditor"</span><span style="color: #ff0000"> assembly</span><span style="color: #0000ff">="CKEditor.NET"</span><span style="color: #ff0000"> namespace</span><span style="color: #0000ff">="CKEditor.NET"/></span></pre> |
|---|
| 42 | <p> |
|---|
| 43 | To insert the CKEditor for ASP.NET Control into a web page, use the following code: |
|---|
| 44 | </p> |
|---|
| 45 | <pre class="samples"><span style="color: #0000ff"><</span><span style="color: #a52a2a">CKEditor</span><span style="color: #0000ff">:</span><span style="color: #a52a2a">CKEditorControl </span><span style="color: #ff0000">ID</span><span style="color: #0000ff">="CKEditor1" </span><span style="color: #ff0000">runat</span><span style="color: #0000ff">="server"></</span><span style="color: #a52a2a">CKEditor</span><span style="color: #0000ff">:</span><span style="color: #a52a2a">CKEditorControl</span><span style="color: #0000ff">></span></pre> |
|---|
| 46 | <p>The CKEditor instance below was inserted using the second method.</p> |
|---|
| 47 | </div> |
|---|
| 48 | <div> |
|---|
| 49 | <CKEditor:CKEditorControl AutoPostBack="true" ID="CKEditor1" runat="server" Height="200" OnTextChanged="CKEditor1_TextChanged" > |
|---|
| 50 | <p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p> |
|---|
| 51 | </CKEditor:CKEditorControl> |
|---|
| 52 | </div> |
|---|
| 53 | <br /><br /> |
|---|
| 54 | <asp:Label |
|---|
| 55 | ID="Label2" |
|---|
| 56 | runat="server" |
|---|
| 57 | Text="Copy of CKEditor content" |
|---|
| 58 | > |
|---|
| 59 | </asp:Label> |
|---|
| 60 | <asp:TextBox |
|---|
| 61 | ID="TextBox2" |
|---|
| 62 | TextMode="MultiLine" |
|---|
| 63 | Columns="50" |
|---|
| 64 | Rows="5" |
|---|
| 65 | runat="server" |
|---|
| 66 | BackColor="LightGoldenrodYellow" |
|---|
| 67 | ForeColor="Crimson" |
|---|
| 68 | > |
|---|
| 69 | |
|---|
| 70 | </asp:TextBox> |
|---|
| 71 | <br /><br /> |
|---|
| 72 | <asp:Label ID="Label3" runat="server" Text="Email"> |
|---|
| 73 | </asp:Label> |
|---|
| 74 | <asp:TextBox ID="TextBox3" runat="server" AutoPostBack="true" OnTextChanged="TextBox3_TextChanged"> |
|---|
| 75 | </asp:TextBox> |
|---|
| 76 | <br /> |
|---|
| 77 | <br /> |
|---|
| 78 | <asp:Label ID="Label4" runat="server" Text="Confirm Email"> |
|---|
| 79 | </asp:Label> |
|---|
| 80 | <asp:TextBox ID="TextBox4" runat="server" BackColor="LightGoldenrodYellow" ForeColor="Crimson"> |
|---|
| 81 | </asp:TextBox> |
|---|
| 82 | |
|---|
| 83 | <div id="footer"> |
|---|
| 84 | <hr /> |
|---|
| 85 | <p> |
|---|
| 86 | CKEditor — The text editor for the Internet — <a class="samples" href="http://ckeditor.com/"> |
|---|
| 87 | http://ckeditor.com</a> |
|---|
| 88 | </p> |
|---|
| 89 | <p id="copy"> |
|---|
| 90 | Copyright © 2003–2011, <a class="samples" href="http://cksource.com/">CKSource</a> |
|---|
| 91 | — Frederico Knabben. All rights reserved. |
|---|
| 92 | </p> |
|---|
| 93 | </div> |
|---|
| 94 | </form> |
|---|
| 95 | </body> |
|---|
| 96 | </html> |
|---|