Format Code Block

4 posts, 0 answers
  1. Libertad
    Libertad avatar
    53 posts
    Member since:
    Sep 2008

    Posted 14 May 2010 Link to this post

    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?

  2. Petio Petkov
    Petio Petkov avatar
    825 posts

    Posted 15 May 2010 Link to this post

    Hi Libertad,

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

    The following online demo demonstrates how you can use the FormatCodeBlock tool of RadEditor:

    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.
  3. Tim
    Tim avatar
    4 posts
    Member since:
    Jun 2011

    Posted 19 Aug 2011 Link to this post

    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?

  4. Rumen
    Rumen avatar
    13747 posts

    Posted 24 Aug 2011 Link to this post

    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,
    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 >>

Back to Top