サイトに fck エディターを実装しましたが、正常に動作しています。しかし、今はそれを ck エディターに変更したいと考えています。エディターは機能していますが、値がデータベースに保存されていません。
これは私のコードです
<CKEditor:CKEditorControl ID="Content" runat="server" BaseHref="~/ckeditor/" Height="400" />
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using Dump.BLL;
using System.IO;
public partial class managenationtheme : System.Web.UI.Page
{
public static string strThemeName = "State-Default";
public static string srtType = "State";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
lblDynamic.Text = "For Dynamic State add key dynamicobjstate where required";
strThemeName = "State-Default";
BindState();
CheckThemeAvailabilityAndLoadPage(strThemeName);
}
}
protected void ddlState_SelectedIndexChange(object sender, EventArgs e)
{
Content.Text = string.Empty;
chkBoxPublish.Checked = false;
if (ddlState.SelectedItem.Value != "0")
{
strThemeName = "State-" + ddlState.SelectedItem.Text;
CheckThemeAvailabilityAndLoadPage(strThemeName);
lblResult.Text = ddlState.SelectedItem.Text + " State Theme :" + btnSave.CommandName.ToUpperInvariant() + " Option";
}
else
{
strThemeName = "State-Default";
CheckThemeAvailabilityAndLoadPage(strThemeName);
lblResult.Text = "Default State Theme :" + btnSave.CommandName.ToUpperInvariant() + " Option";
}
}
public void CheckThemeAvailabilityAndLoadPage(string ThemeNamestr)
{
DataSet ds = Dump.BLL.Theme.CheckThemeAvailable(ThemeNamestr);
if (ds.Tables[0].Rows.Count > 0)
{
btnSave.Text = "Save";
btnSave.CommandName = "edit";
Content.Text = ds.Tables[0].Rows[0]["Theme"].ToString();
chkBoxPublish.Checked = Convert.ToBoolean(ds.Tables[0].Rows[0]["ThemePublished"].ToString());
if (ddlState.SelectedItem.Value == "0")
{
lblResult.Text = "Default State Theme!";
}
else
{
lblResult.Text = ddlState.SelectedItem.Value.ToString().ToUpperInvariant() + " State Theme!";
}
}
else
{
btnSave.Text = "Save";
btnSave.CommandName = "save";
chkBoxPublish.Checked = false;
if (ddlState.SelectedItem.Value == "0")
{
lblResult.Text = "Add Default State Theme!";
Content.Text = string.Empty;
}
}
BindDataList();
}
protected void btnSave_Click(object sender, EventArgs e)
{
if (btnSave.CommandName == "save")
{
SaveTheme(strThemeName);
}
else if (btnSave.CommandName == "edit")
{
EditTheme(strThemeName);
}
}
public void EditTheme(string strLocationName)
{
Theme objtheme = new Theme();
objtheme.ThemeName = strLocationName;
objtheme.ThemeValue = Content.Text;
objtheme.ThemePublished = true;
int i = Dump.BLL.Theme.Update(objtheme);
if (i > 0)
{
lblResult.Text = "Theme Updated and Published!";
chkBoxPublish.Checked = true;
}
else
{
lblResult.Text = "Error!";
}
BindDataList();
}
public void SaveTheme(string strLocationName)
{
Theme objtheme = new Theme();
objtheme.ThemeType = srtType;
objtheme.ThemeName = strLocationName;
objtheme.ThemeValue = Content.Text;
objtheme.ThemePublished = true;
objtheme.Zip = "";
objtheme.City = "";
if (ddlState.SelectedItem.Value != "0")
{
objtheme.State = ddlState.SelectedItem.Value.ToString();
}
else
{
objtheme.State = "All-State-Default";
}
int i = Dump.BLL.Theme.Insert(objtheme);
if (i > 0)
{
lblResult.Text = "Theme Created and Published!";
btnSave.CommandName = "edit";
chkBoxPublish.Checked = true;
}
else
{
lblResult.Text = "Error!";
}
BindDataList();
}
protected void chkBoxPublish_Clicked(Object sender, EventArgs e)
{
Theme objtheme = new Theme();
objtheme.ThemeName = strThemeName;
objtheme.ThemePublished = chkBoxPublish.Checked;
int i = Dump.BLL.Theme.CheckPublishStatus(objtheme);
if (i > 0)
{
if (chkBoxPublish.Checked)
{
lblResult.Text = "Theme Published!";
}
else
{
lblResult.Text = "Theme Un-Published!";
}
}
BindDataList();
}
public void BindDataList()
{
DataSet ds = Dump.BLL.Theme.GetDefaultThemeStateList();
if (ds.Tables[0].Rows.Count > 0)
{
DataListDefaultState.DataSource = ds.Tables[0];
DataListDefaultState.DataBind();
lblDataListDefaultState.Text = "";
}
else
{
lblDataListDefaultState.Text = "Sorry! No Items added";
}
DataSet ds2 = Dump.BLL.Theme.GetUniqueThemeStateList();
if (ds2.Tables[0].Rows.Count > 0)
{
DataListUniqueState.DataSource = ds2.Tables[0];
DataListUniqueState.DataBind();
lblDataListUniqueState.Text = "";
}
else
{
lblDataListUniqueState.Text = "Sorry! No Items added";
}
}
}
私は 1 つの変更のみを変更しました。つまり、Fckeditor1.value を Content.text に変更しました。
Content は私の ckeditor ID です。
誰でも助けてもらえますか?