This is a migrated thread and some comments may be shown as answers.

Format Code Block

3 Answers 188 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Libertad
Top achievements
Rank 1
Libertad asked on 14 May 2010, 06:40 PM
Hi There,
I want t add format code block like one you have in this html editor.
would you please send me a sample about adding format code block functionality to a html editor?

Thanks

3 Answers, 1 is accepted

Sort by
0
Petio Petkov
Telerik team
answered on 15 May 2010, 02:02 PM
Hi Libertad,

You should add tool with name "FormatCodeBlock" to RadEditor's tools collection,e.g.
<telerik:RadEditor ID="RadEditor1" runat="server">
                <Tools>
                    <telerik:EditorToolGroup>
                        <telerik:EditorTool Name="FormatCodeBlock" Text="Format Code Block Dialog" />
                    </telerik:EditorToolGroup>
                </Tools>
</telerik:RadEditor>

The following online demo demonstrates how you can use the FormatCodeBlock tool of RadEditor:
http://demos.telerik.com/aspnet-ajax/editor/examples/xhtmlvalidatortrackchangesformatcodeblockdialogs/defaultcs.aspx

Regards,
Petio Petkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Tim
Top achievements
Rank 1
answered on 19 Aug 2011, 08:47 PM
I have a follow-up to this.  I want to have an "editor" on my page that should have no other functionality at all; no menus, no tools, nothing.  But text that's entered into it gets formatted using the same language specific formatting like the Format Code Block tool used in the RadEditor.  Basically, my page has a text area where the users must enter SQL queries.  I'd *LOVE* it if what they enter can be formatted nicely similar to how it looks when the do it in SQL Server Management Server or in one of the Oracle tools.  Any basic SQL formatting would be cool.

If RadEditor can't do it, is there another control that can?  If not a Telerik control, can anyone point me to some other asp control I could use for this one box?

Tim
0
Rumen
Telerik team
answered on 24 Aug 2011, 02:43 PM
Hello Tim,

You can see how to render RadEditor as a textbox without toolbars in this live demo: Displaying RadEditor as a TextBox. You can hide the toolbar tools and modules by setting the ToolsFile property to point to an XML file having only <root></root> tags in it.

RadEditor does not offer the requested code colorizing feature out-of-the box and we do not plan to provide support for it for the time being.

The RadControls Quick Start Framework features such a tool for its C#/VB/ASPX tabs underneath each example. The tool is delivered as source code and is available in the App_Code\QuickStart folder of the demo application (C:\Program Files (x86)\Telerik\RadControls for ASP.NET AJAX Q2 2011\Live Demos\App_Code\QuickStart\CodeViewerHelper.cs)

What you could do is add the QuickStart folder to your own application's App_Code, and then a single line of code will do the trick, e.g.

RadEditor1.Content = Telerik.QuickStart.CodeViewerHelper.RenderFile(Server.MapPath("Default.aspx.vb"));

The RenderFile method could read XML, ASPX, C# and VB.NET content.

Kind regards,
Rumen
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Editor
Asked by
Libertad
Top achievements
Rank 1
Answers by
Petio Petkov
Telerik team
Tim
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or