Try Now
More in this section

Forums / Set-up & Installation / Remove items for Generic content control

Remove items for Generic content control

2 posts, 0 answered
  1. Scott Williams
    Scott Williams avatar
    14 posts
    13 Oct 2009
    13 Oct 2009
    Link to this post
    Is there a way that I can remove some of the WSWIG toolbar from the Generic content controls. I picture speaks a thousand worlds so I have attached an image of what I'm trying to achieve below.


    Basically I want to restrain how much a user can input and change text etc within a Generic Content Control. Any help would be brilliant thanks
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    25 Oct 2016
    13 Oct 2009
    Link to this post
    Hello Scott Williams,

    The toolbar is populated from ToolsFile.xml. First you need to map the external template for Generic Content control and then modify the references ToolsFile.xml or create a new one, especially prepared for your Generic Content control.

    You can also add the following logic OnClientLoad to restrict the number of characters if necessary.

    <script type="text/javascript">
        var MaxLenght = 250;
        var message = 'THE MAX LENGHT IS' + MaxLenght + ' characters!';
        var counter = $get('counter');
        function LimitLength(mode) {
            var GCEditor = $find("<%=RadEditor.ClientID %>");
            if (mode == 2) {
                var oValue = GCEditor.get_textArea().innerHTML.trim().length;
            else { var oValue = GCEditor.get_html(true).trim(); }
            if (oValue.length >= MaxLenght) {
                GCEditor.set_html(oValue.substring(0, MaxLenght - 1));
            counter.innerHTML = "Characters left: " + (MaxLenght - oValue.length);
        function AttachHandlers(mode) {
            var GCEditor = $find("<%=RadEditor.ClientID %>");
            if (mode == 1) {
                GCEditor.attachEventHandler("onkeyup", LimitLength);
                GCEditor.attachEventHandler("onpaste", LimitLength);
                GCEditor.attachEventHandler("onblur", LimitLength);
            else {
                var textarea = GCEditor.get_textArea();
                if (window.attachEvent) {
                    textarea.attachEvent("onkeydown", LimitLength);
                    textarea.attachEvent("onpaste", LimitLength);
                    textarea.attachEvent("onblur", LimitLength);
                else {
                    textarea.addEventListener("keyup", LimitLength, true);
                    textarea.addEventListener("paste", LimitLength, true);
                    textarea.addEventListener("blur", LimitLength, true);
        function OnClientLoad(editor, args) {
            GCEditor = editor;
            editor.add_modeChange(function(sender, args) {
                var mode = sender.get_mode();
                if (mode == 1 || mode == 2) {

    I hope this helps.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered