Reputation: 5884
I have database with 'students' and 'courses'. If a student finishes a course, he will get an 'achievement'. Achievements can be printed at once for all students. Here I have no problem.
Problem is when I wanna to do a customizable achievement paper (font, color, position, images). In Windows Forms, there is RichTextEdit
, so it is easy to customize.
But how to do it in ASP.NET? Can editors like tinyMCE be integrated with ASP.NET? And can I send information to tinyMCE (or other editor) to change some substrings like {student-name} {course-name} into specified text from database?
Upvotes: 1
Views: 798
Reputation: 11433
It sounds like the AJAX Control Toolkit rich text solution would be useful to you: HTMLEditorExtender
. It is easy to use, and integrates with Visual Studio rather smoothly.
All you have to do is attach the Extender to a TextBox
control. See the documentation page I linked to above for details, but basically all you need is a TextBox
and then the extender markup. Make sure that in the extender markup, you set the "TargetControlID" property to the ID of the TextBox you want to use as a "rich text box".
<asp:TextBox runat="server" ID="myTextBox"></asp:TextBox>
<ajaxToolkit:HtmlEditorExtender ID="HtmlEditorExtender1"
TargetControlID="myTextBox" DisplaySourceTab="true"
runat="server"/>
<Toolbar>
<ajaxToolkit:Undo />
<ajaxToolkit:Redo />
<ajaxToolkit:Bold />
<ajaxToolkit:Italic />
<ajaxToolkit:Underline />
...
<!--And many more properties, see the linked documentation for more-->
...
</Toolbar>
</ajaxToolkit:HtmlEditorExtender>
Notice that the ID of the TextBox
control is "myTextBox" and the TargetControlID of the HTMLEditorExtender
is also "myTextBox".
Note: The AJAX Control Toolkit is generally considered to be sort of "heavy" or "clunky" as far as performance goes (I usually recommend jQuery solutions over it), but it is really easy to use (especially for beginners), and for small projects works fine.
Upvotes: 1