1

I want to show C# Editor in a web page, Intellisence not required.

1

1 Answer 1

9

You could use Code Mirror, it provides support for C, C++ & C# among other languages.

Simple example:

<script src="/Js/codemirror.js"></script>
<script src="/Js/javascript.js"></script>
<script src="/Js/xml.js"></script>
<script src="/Js/css.js"></script>
<script src="/Js/htmlembedded.js"></script>

<script type="text/javascript">
    $(document).ready(function () {
        var element = document.getElementById("<%= txtCodeArea.ClientID %>");
        var editor = CodeMirror.fromTextArea(element , {
            parserfile: "/Js/htmlembedded.js",
            stylesheet: "/Css/codemirror.css",
            path: "/Js/"
        });
    });
</script>

Load in the relevant js files, you find these in the mode folder from the download.

The script gets the element you want to use for code editing and includes the syntax highlighting/coloring for the .js files that you've included. txtCodeArea could refer to a multi-line <asp:TextBox />.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.