This is a migrated thread and some comments may be shown as answers.

Remove default toolbar

4 Answers 182 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kjell
Top achievements
Rank 1
Iron
Kjell asked on 21 Jan 2015, 02:44 PM
How remove the default toolbar in telerik:GridHTMLEditorColumn?
I just want to use my own buttons I create server side....

4 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 21 Jan 2015, 06:16 PM
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
0
Kjell
Top achievements
Rank 1
Iron
answered on 21 Jan 2015, 10:46 PM
This remove all.
I want to remove the default toolbar. But I want to save my own EditorToolGroup.
Se attached image....
0
Konstantin Dikov
Telerik team
answered on 26 Jan 2015, 09:40 AM
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.

 
0
Kjell
Top achievements
Rank 1
Iron
answered on 26 Jan 2015, 04:32 PM
Thanks, works fine....
Tags
Grid
Asked by
Kjell
Top achievements
Rank 1
Iron
Answers by
Jayesh Goyani
Top achievements
Rank 2
Kjell
Top achievements
Rank 1
Iron
Konstantin Dikov
Telerik team
Share this question
or