I want to show C# Editor in a web page, Intellisence not required.
1 Answer
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 />.