0

I have used a rich textbox control,ckeditor in my case,When any formatting is done to the text the formatted text is populated in the datagrid.But I want to extract only the plain text in the grid and trim the length of data to 80 characters while populating.

The query for updating the answer is as follows

    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";

and the query for populating data in the grid is as follows:

    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";

can plz some buddy help me!!

1 Answer 1

2

Use the HTML agility pack, parse your query result on ItemDataBound event then select only the text() nodes to display

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.