tags:

views:

15

answers:

1

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!!

+2  A: 

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

Gregoire