.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!



Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

How to display the text in the second ck editor with strikes while extracting from database

Posted By: abc     Posted Date: November 04, 2016    Points:5   Category :C#
In my application i need to add a button below ckeditor and on clicking that link button i need to display two ckeditors on ck editor is to display the text that is given in ckeditor and another ckeditor is to display the error text that means the process is in ckeditor we will have large amount of text on where user can edit some text in it and on clicking the button the text gets saved in database and now i need to add another button and on clicking that button i need to retrive the data that is saved in database and display the text that is saved in database in two columns as transcribed text and and compared text i am able to retrive the text into two ckeditors but for the text in second ck editor i need to display strikes.

protected void Page_Load(object sender, EventArgs e)
{
if (Session["uid"] == null)
{
Response.Redirect("Login.aspx");
}
adm = new Admin();
if (!IsPostBack)
{
BindGrid();
}
}
protected void BindGrid()
{
string query = "select ID,TranscriptionText,ComparedText from MTworkStatus where ID='" + 300 + "'";
SqlCommand cmd = new SqlCommand(query, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
string id = dt.Rows[i]["ID"].ToString();
string TranscriptionText = dt.Rows[i]["TranscriptionText"].ToString();
string ComparedText = dt.Rows[i]["ComparedText"].ToString();
Session["TranscriptionText"] = TranscriptionText.ToString();
Session["ComparedText"] = ComparedText.ToString();
}

}
string ttext = Session["TranscriptionText"].ToString();
string Text1 = ttext.ToString();
Text1 = Text1.Replace("<del", "<s><span");
Text1 = Text1.Replace("</del", "</s></span");
Text1 = Text1.Replace("<s style=", "<s><span style=");
CKEditorControl1.Text = Text1;

string ctext = Session["ComparedText"].ToString();
string Text = ctext.ToString();
Text = Text.Replace("<del", "<s><span");
Text = Text.Replace("</del", "</s></span");
Text = Text.Replace("<s style=", "<s><span style=");
CKEditorControl2.Text = Text;
}
}


<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>


<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="main" style="background-color: #E2E6E9;">
<center><h3>TRANSCRIPTION TEXT</h3></center>
<table>
<CKEditor:CKEditorControl ID="CKEditorControl1" BasePath="/ckeditor/" runat="server" Width="900px" Height="163px"></CKEditor:CKEditorControl>

</table>
<br />
<center><h3>COMPARED TEXT</h3></center>
<table>
<CKEditor:CKEditorControl ID="CKEditorControl2" BasePath="/ckeditor/" runat="server" Width="900px" Height="163px"></CKEditor:CKEditorControl>

</table>
</div>

</asp:Content>


Responses
Author: david stephan             
Posted Date: December 01, 2016     Points: 20   

To display the text in the second ck editor with strikes while extracting from database, trivial - encode your content before printing it to textarea like below:

<textarea><? echo htmlspecialchars( $contentFromDB ); ?></textarea>

Hope this will help you somehow.

Revert me if it is done.

:)



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend