我使用了富文本框控件,在我的情况下使用ckeditor,当对文本进行任何格式化时,格式化文本将填充到datagrid中。但是我想只提取网格中的纯文本并修剪长度填充时数据为80个字符。
更新答案的查询如下
protected void btnUpdate_Click(object sender, EventArgs e)
{
if (txtEditorAnswer.Text.Trim() != string.Empty)
{
int intIsUpdated = 0;
string strUpdateQuery = "UPDATE M_QA SET ANSWER = '" + txtEditorAnswer.Text.Trim().Replace("'", "''")
+ "', UPDATED_ON = getDate(), UPDATED_BY = '" + this.Session["UserId"].ToString()
+ "' WHERE PK_ID = " + _currentQuestionId + " AND IS_ACTIVE = 1";
以及在网格中填充数据的查询如下:
protected void LoadQA(int intQuestionId)
{
string strSelectQuery = "SELECT REPLACE(TITLE, '\n', '<br />') TITLE, REPLACE(DESCRIPTION, '\n', '<br />') DESCRIPTION, "
+ "ANSWER, FK_OWNER_ID, CREATED_ON FROM M_QA WHERE PK_ID = "
+ intQuestionId + " AND IS_ACTIVE = 1";
可以请一些伙伴帮助我!!