I need to create multiple FCKeditors programmatically. In my code, I have tried using CreateHtml() and RenderControl(). Both of these just create a plain HTML textarea. Here is my code, please help me:
while (reader1.Read())
{
int repId = reader1.GetInt32(0);
int userId = reader1.GetInt32(1);
string date = reader1.GetDateTime(2).ToShortDateString();
string statRep = reader1.GetString(3);
string userName = "";
repIds += repId.ToString() + ",";
User statUser;
try
{
statUser = new User(userId);
userName = statUser.GetFirstName() + " " + statUser.GetLastName();
}
catch (Exception theException)
{
userName = "Unknown";
}
postContent.Text += "<div><span class='forumResponseAuthor2'>" + userName + "</span> <span class='forumResponseSays'>Says:</span></div>";
postContent.Text += "<div class='forumResponseDate'>" + date + "</div>";
postContent.Text += "<div style='height:5px'></div>";
System.Text.StringBuilder sBuilder = new System.Text.StringBuilder();
System.IO.StringWriter strWriter = new System.IO.StringWriter(sBuilder);
HtmlTextWriter htmlWriter = new HtmlTextWriter(strWriter);
FCKeditor newEditor = new FCKeditor();
newEditor.ID = "editor" + repId.ToString();
newEditor.Height = new Unit(100);
newEditor.Width = new Unit(300);
newEditor.Visible = true;
newEditor.BasePath = "~/fckeditor/";
newEditor.ToolbarSet = "Basic";
newEditor.Visible = true;
newEditor.Value = statRep;
newEditor.RenderControl(htmlWriter);
postContent.Text += sBuilder.ToString();
postContent.Text += "<div style='height:10px'></div>";
}