-
January 15th, 2020, 02:43 AM
#1
How to use FCKeditorV2 instead of FreeTextBox ?
I want to use FCKeditorV2 (Figure 2) [link to file removed]
instead of FreeTextBox (Figure 1) [link to file removed]
The code I have edited
Code:
In file ArticleAddEdit.aspx
line 5:
original
<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
edit
<%@ Register TagPrefix="FCKeditorV2" Namespace="FredCK.FCKeditorV2" Assembly="FredCK.FCKeditorV2" %>
line 79:
original:
<FTB:FreeTextBox id="txtBody"
TabIndex="3"
toolbarlayout="FontFacesMenu,FontSizesMenu,FontForeColorsMenu,FontForeColorPicker,FontBackColorsMenu,FontBackColorPicker|Bold,Italic,Underline,Strikethrough,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink|InsertTable,EditTable,InsertImageFromGallery"
runat="Server"
Width="585px" Height="200px"
/>
edit:
<FCKeditorV2:FCKeditor id="txtBody" ToolbarSet="MyToolbar" Width="600" Height="300" BasePath="~/FCKeditor/" runat="server" />
But when I change the code the following error message: [link to file removed]
Line 40: txtTitle.Text = obj.Title;
Line 41: txtExcerpt.Text = obj.Excerpt;
Line 42: txtBody.Text = obj.Body;
Line 43: if (obj.Priority == 1)
Line 44: chkPriority.Checked = true;
For the original code
Code:
In file In file ArticleAddEdit.aspx
<%@ Page ValidateRequest="false" Language="C#" Theme="WebMaster" MasterPageFile="~/WebMaster/MasterPage.master" AutoEventWireup="true" CodeFile="ArticleAddEdit.aspx.cs" Inherits="webapp4U.UI.ArticleAddEdit" %>
<%@ Register Src="~/WebMaster/Controls/Title.ascx" TagName="Title" TagPrefix="uc" %>
<%@ Import Namespace="webapp4U" %>
<%@ Register TagPrefix="webapp4U" Namespace="webapp4U.UI" %>
<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PageContent" Runat="Server">
<uc:Title runat="server" ResourceKey='' Text='cập nhật bÃ*i việt' />
<table width="595" border="0" align="center" cellpadding="0" cellspacing="0">
<tr style="padding-top:5pt;">
<td colspan="2" align="center">
<asp:Label runat="server" ID="lblMsg" Font-Bold="true" ForeColor="blue"></asp:Label>
</td>
</tr>
<tr>
<td width="75%" >
<asp:ValidationSummary runat="server" ID="valChangePasswordSummary" ShowMessageBox="true" ShowSummary="false" />
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><b><%=ResourceManager.GetString("ArticleCategory") %>:</b></td>
</tr>
<tr>
<td style="padding-top:3pt;">
<webapp4U:ddlArticleCategory ID="dlArticleCategory" runat="server" CssClass="Textbox" />
<asp:RangeValidator runat="server" ControlToValidate="dlArticleCategory" ID="rvl1"
Type="Integer" MinimumValue="2" MaximumValue="1000" Display="dynamic"
ErrorMessage="Category not null" />
</td>
</tr>
<tr>
<td style="padding-top:10pt;"><b><%=ResourceManager.GetString("Title") %>:</b></td>
</tr>
<tr>
<td style="padding-top:3pt;">
<asp:TextBox ID="txtTitle" TabIndex="1" Font-Bold="true" runat="server" Width="380" MaxLength="500"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtTitle" runat="server" ErrorMessage="Title not null" Display="None" />
</td>
</tr>
<tr>
<td style="padding-top:10pt;"><b><%=ResourceManager.GetString("Article_Trichdan") %>:</b></td>
</tr>
<tr style="padding-top:3pt;">
<td>
<asp:TextBox ID="txtExcerpt" TabIndex="2" TextMode="MultiLine" Rows="5" runat="server" Width="380" MaxLength="3000"></asp:TextBox>
</td>
</tr>
</table>
</td>
<td valign="top" width="90" style="padding-top:20pt;">
<table border="0" cellpadding="0" width="90" >
<tr>
<td style="padding-top:5pt;" height="90" width="100%" valign="top" align="center">
<img name="ImageItem" id="ImageItem" runat="server" border="1" src="~/WebMaster/Images/Picture.jpg" width="80"/>
<input type="hidden" runat="server" id="HiddenImageName" name="HiddenImageName" value="" />
<input type="hidden" runat="server" id="HiddenImageWidth" name="HiddenImageWidth" value="-1" />
<input type="hidden" runat="server" id="HiddenImageHeight" name="HiddenImageHeight" value="-1" />
</td>
</tr>
<tr>
<td>
<input type="button" class="btupload" value=" Upload Picture" onclick='window.open("UploadFile.aspx?ActUpload=article","khunghinh","width=420,height=200,menubar=no,scrollbars=yes")' />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><br /></td>
</tr>
<tr style="padding-top:8pt; padding-bottom:3pt;">
<td colspan="2" ><b><%=ResourceManager.GetString("Article_Body") %> :</b></td>
</tr>
<tr>
<td colspan="2" style="font-size:0.7em">
<FTB:FreeTextBox id="txtBody"
TabIndex="3"
toolbarlayout="FontFacesMenu,FontSizesMenu,FontForeColorsMenu,FontForeColorPicker,FontBackColorsMenu,FontBackColorPicker|Bold,Italic,Underline,Strikethrough,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink|InsertTable,EditTable,InsertImageFromGallery"
runat="Server"
Width="585px" Height="200px"
/>
</td>
</tr>
<tr>
<td colspan="2" align="right" style="padding-top:7pt; padding-right:3pt; padding-bottom:20pt;">
<asp:CheckBox runat="server" ID="chkPriority" Text="" TextAlign=Left />
Tin nổi bật(Hiển thị trên cùng)
<asp:Button runat="server" TabIndex="4" ID="btSave" OnClick="btSave_Click" Text=" Save " CssClass="textbox" />
</td>
</tr>
</table>
<br /><br /><br /><br />
</asp:Content>
In file In file ArticleAddEdit.aspx.cs
namespace webapp4U.UI
{
public partial class ArticleAddEdit : System.Web.UI.Page
{
private int ArticleID = -1;
private int CateID = -1;
protected void Page_Load(object sender, EventArgs e)
{
// lay ArticleID khi chinh sua
ArticleID = Globals.GetIntFromQueryString("ArticleID");
CateID = Globals.GetIntFromQueryString("CateID");
if (Request.QueryString["Action"] == "Edit")
{
btSave.CommandArgument = "Edit";
btSave.Text = " Update ";
if (!IsPostBack)
{
Load_GetItemByArticleID(ArticleID);
}
}
}
protected void Load_GetItemByArticleID(int ArticleID)
{
webapp4U.BOL.Article obj = webapp4U.BOL.Article.GetArticleByArticleID(ArticleID);
txtTitle.Text = obj.Title;
txtExcerpt.Text = obj.Excerpt;
txtBody.Text = obj.Body;
if (obj.Priority == 1)
chkPriority.Checked = true;
if(obj.ImageURL.Length>3)
ImageItem.Src = Globals.ApplicationPath + "/UserUpload/Articles/" + obj.ImageURL;
if (obj.ImageWidth > obj.ImageHeight)
ImageItem.Width = 80;
else
ImageItem.Height = 80;
dlArticleCategory.SelectedValue = obj.ArticleCateID.ToString();
HiddenImageName.Value = obj.ImageURL;
HiddenImageWidth.Value = obj.ImageWidth.ToString();
HiddenImageHeight.Value = obj.ImageHeight.ToString();
}
protected void btSave_Click(object sender, EventArgs e)
{
webapp4U.BOL.Article obj = new webapp4U.BOL.Article();
obj.ArticleID = ArticleID;
obj.Title = txtTitle.Text.Trim();
obj.Excerpt = txtExcerpt.Text.Trim().Replace(Environment.NewLine, "<br>");
obj.Body = txtBody.Text;
obj.PostDate = DateTime.Now;
obj.Priority = 0;
if (chkPriority.Checked)
obj.Priority = 1;
obj.ImageURL = HiddenImageName.Value.Trim();
obj.ImageWidth = Convert.ToInt32(HiddenImageWidth.Value.Trim());
obj.ImageHeight = Convert.ToInt32(HiddenImageHeight.Value.Trim());
obj.Authors = " ";
obj.ArticleCateID = Globals.ConvertToInt32(dlArticleCategory.SelectedItem.Value);
if (btSave.CommandArgument == "Edit")
{
obj.TotalViews = 0;
webapp4U.BOL.Article.Update(obj);
//Response.Redirect("ArticleDetail.aspx?ArticleID=" + ArticleID);
}
else
{
webapp4U.BOL.Article.Insert(obj);
//txtBody.Text = "";
//txtTitle.Text = "";
//txtExcerpt.Text = "";
}
Response.Redirect("Default.aspx?CateID=" + CateID);
lblMsg.Text = "Cập nhật thông tin thÃ*nh công!";
}
}
}
or see the attached file: [link to file removed]
Reference links
https://expressmagazine.net/developm...vao-web-aspnet
https://docs-old.ckeditor.com/FCKedi...ration/ASP.NET
Last edited by Arjay; January 15th, 2020 at 09:43 AM.
Reason: Removed external file links
-
February 2nd, 2020, 07:38 AM
#2
Re: How to use FCKeditorV2 instead of FreeTextBox ?
In your other thread I mentioned about staying with current technologies. The first link above shows creating a new project with asp.net. In the screenshot there is also a new project template option for creating an MVC 2 project. ASP.NET MVC 2 came out in 2009. So this looks like VS2010.
The dangers of using such old technology is: 1) it's hard to find help; and, 2) it may no longer be supported.
This is exactly the case here. From your second link:
This website contains links to software which is either no longer maintained or will be supported only until the end of 2019 (CKFinder 2). For the latest documentation about current CKSource projects, including software like CKEditor 4/CKEditor 5, CKFinder 3, Cloud Services, Letters, Accessibility Checker, please visit the new documentation website.
If you look for an information about very old versions of CKEditor, FCKeditor and CKFinder check also the CKEditor forum, which was closed in 2015. If not, please head to StackOverflow for support.
Last edited by Arjay; February 2nd, 2020 at 07:44 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|