Remove default toolbar

5 posts, 0 answers
  1. Kjell
    Kjell avatar
    203 posts
    Member since:
    May 2011

    Posted 21 Jan 2015 Link to this post

    How remove the default toolbar in telerik:GridHTMLEditorColumn?
    I just want to use my own buttons I create server side....
  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 21 Jan 2015 in reply to Kjell Link to this post

    Hello,

    Please try with the below code snippet.

    <style>
        .MyEditor .reToolCell,
        .MyEditor .reEditorModesCell {
            display: none !important;
        }
    </style>
    <telerik:GridHTMLEditorColumn DataField="Name" UniqueName="HTMLEditorColumnUniqueName"></telerik:GridHTMLEditorColumn>
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            GridEditableItem item = (GridEditableItem)e.Item;
            RadEditor editor = (RadEditor)item["HTMLEditorColumnUniqueName"].Controls[0];
            editor.CssClass = "MyEditor";
        }
    }

    Let me know if any concern.

    Thanks,
    Jayesh Goyani
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kjell
    Kjell avatar
    203 posts
    Member since:
    May 2011

    Posted 21 Jan 2015 in reply to Jayesh Goyani Link to this post

    This remove all.
    I want to remove the default toolbar. But I want to save my own EditorToolGroup.
    Se attached image....
  5. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 26 Jan 2015 Link to this post

    Hi Kjell,

    You can handle the OnItemCreated event of grid, get reference to the RadEditor, clear the Tools collection and add your custom collection. Following is a very basic example achieving such result:
    <telerik:RadGrid ID="RadGrid1" GridLines="None" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCreated="RadGrid1_ItemCreated">
        <MasterTableView CommandItemDisplay="TopAndBottom" AutoGenerateColumns="False">
            <Columns>
                <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
                <telerik:GridHTMLEditorColumn DataField="Test" UniqueName="HTMLEditorColumnUniqueName"></telerik:GridHTMLEditorColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>

    And the code-behind:
    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        DataTable table = new DataTable();
        table.Columns.Add("ID", typeof(int));
        table.Columns.Add("Test", typeof(string));
        for (int i = 0; i < 5; i++)
        {
            table.Rows.Add(i, "Test");
        }
        (sender as RadGrid).DataSource = table;
    }
     
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            GridEditableItem editableItem = e.Item as GridEditableItem;
            RadEditor editor = editableItem["HTMLEditorColumnUniqueName"].Controls[0] as RadEditor;
            editor.Tools.Clear();
            EditorToolGroup group = new EditorToolGroup();
            group.Tools.Add(new EditorTool() { Name = "LinkManager" });
            group.Tools.Add(new EditorTool() { Name = "InsertLink" });
            editor.Tools.Add(group);
        }
    }

    Hope this helps.


    Regards,
    Konstantin Dikov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Kjell
    Kjell avatar
    203 posts
    Member since:
    May 2011

    Posted 26 Jan 2015 in reply to Jayesh Goyani Link to this post

    Thanks, works fine....
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017