4 Answers, 1 is accepted
0
Jayesh Goyani
Top achievements
Rank 2
answered on 21 Jan 2015, 06:16 PM
Hello,
Please try with the below code snippet.
Let me know if any concern.
Thanks,
Jayesh Goyani
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
0
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:
And the code-behind:
Hope this helps.
Regards,
Konstantin Dikov
Telerik
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....