I am currently looking for a way to load data into an instance of CKEDITOR using C# the examples I've seen online use jquery, but I need it for c#
my ckeditor looks like so:
<asp:TextBox ID="txtArt" runat="server" ></asp:TextBox>
<script>
CKEDITOR.replace('<%=txtArt.ClientID %>', {
htmlEncodeOutput: false,
height: '400px',
width: '500px',
resize_enabled: false,
removePlugins: 'elementspath'
});
</script>
and I'm using this code in c#:
public String Value
{
get
{
EnsureChildControls();
return txtArt.Text;
}
set
{
EnsureChildControls();
txtArt.Text = value;
}
}
protected override void OnInit(EventArgs e)
{
if (!Page.ClientScript.IsClientScriptIncludeRegistered("ckeditor.js"))
{
Page.ClientScript.RegisterClientScriptInclude("ckeditor.js", "/ckeditor/ckeditor.js");
}
base.OnInit(e);
}
I know that loads the js file, and will save any text in the block, but how do I set default data in said block?
I've tried the normal
txtArt.Text = "Hello";
but that doesn't work. it loads up with empty fields. is there a way to do something like How to add data to CKEditor using JQuery ? or How to load data into ckeditor onload ?
Please be advised, I'm trying to load data from a database. so my code on the .cs page is the code I need for the loading.