尝试更新CKEditors文本时,它会保存旧值 [英] When trying to Update the CKEditors text it saves the old values
问题描述
嗨!全部
我正在尝试使用我的ADO.Net代码更新CKEditor的文本:
我点了这个链接 [ ^ ]在我的应用程序中设置ckeditor。
我从更新按钮点击事件调用以下方法。
以下是我的代码
public void updatetext()
{
SqlConnection _SqlConnection = new SqlConnection(GetConnectionString());
try
{
string sqlStatement = string.Empty;
int ID = 2;
string _textstring = CKEditor1.Text;
string str1 = Server.HtmlEncode(_textstring);
string str2 = Server.HtmlDecode(str1);
_textstring = str2;
sqlStatement =UPDATE Marquee SET MarqueeText = N'+ _textstring +';
_SqlConnection.Open();
SqlCommand cmd = new SqlCommand(sqlStatement,_SqlConnection);
cmd.Parameters.AddWithValue(@ ID,ID);
cmd.CommandType = CommandType.Text; < br $>
cmd.ExecuteNonQuery();
LoadMarqueeText();
}
catch(异常_Exception)
{
throw _Exception;
}
终于
{
_SqlConnection.Close();
_SqlConnection.Dispose();
}
}
当我更改某些文本时,当我单击更新按钮单击事件时,它不显示已更改的文本,而是显示旧的val UE的。我该如何解决这个问题?
任何人都可以帮我解决这个问题吗?
谢谢
Hi! All
I'm trying to update the text of CKEditor using my ADO.Net code:
I followed this link[^] to setup the ckeditor in my application.
I'm calling the following method from the update button click event.
Following is my code
public void updatetext()
{
SqlConnection _SqlConnection = new SqlConnection(GetConnectionString());
try
{
string sqlStatement = string.Empty;
int ID = 2;
string _textstring = CKEditor1.Text;
string str1 = Server.HtmlEncode(_textstring);
string str2 = Server.HtmlDecode(str1);
_textstring = str2;
sqlStatement = "UPDATE Marquee SET MarqueeText = N'" + _textstring + "'";
_SqlConnection.Open();
SqlCommand cmd = new SqlCommand(sqlStatement, _SqlConnection);
cmd.Parameters.AddWithValue("@ID", ID);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
LoadMarqueeText();
}
catch (Exception _Exception)
{
throw _Exception;
}
finally
{
_SqlConnection.Close();
_SqlConnection.Dispose();
}
}
When I change some text and when I click on Update button click event it doesn't show the changed text instead it show the old values. How can I Fix this?
Can any one please help me out with this?
Thanks
推荐答案
我没有在Pageload中提到IsPostback,这就是为什么它没有更新我的值。
I did not mention IsPostback in Pageload and that's why it wasn't updating my values.
这篇关于尝试更新CKEditors文本时,它会保存旧值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!