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

Change default HTML output for a tool

3 Answers 21 Views
Editor
This is a migrated thread and some comments may be shown as answers.
William Hurst
Top achievements
Rank 1
William Hurst asked on 13 Jul 2012, 11:29 AM
I am trying to change the default HTML output of the table tool so that whenever it is used the HTML inserted has the width automatically set to 100% and the margin and padding set to 0. I've tried using "OnClientCommandExecuting" but I'm not sure I'm going down the right path. Can this be achieved?

3 Answers, 1 is accepted

Sort by
0
William Hurst
Top achievements
Rank 1
answered on 17 Jul 2012, 11:54 AM
Is this even possible? A nudge in the right direction will help as well.
0
Rumen
Telerik team
answered on 17 Jul 2012, 01:47 PM
Hello,

There are two approaches that you can try:
1) The first one is to define a global CSS Class for table or td elements and apply it to the content area. See these resources for more information:
Customize Content Area
and
Setting Content Area Defaults
2) The other option is to attach to the OnClientPasteHtml event and modify the content inserted via the InsertTable and TableWizard tools.

Kind regards,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
William Hurst
Top achievements
Rank 1
answered on 14 Aug 2012, 09:03 AM
In case anyone is wondering, this is what I eventually ended up doing (requires jQuery):

function ParseHtmlEditorContent(sender, args) {
var commandName = args.get_commandName();
var value = args.get_value();

if (commandName == "InsertTable") {
var table = $(value)[0];
table.width = '100%';
$(table).attr("cellspacing", "0").attr("cellpadding", "0");
args.set_value(table.outerHTML);
}
}
Tags
Editor
Asked by
William Hurst
Top achievements
Rank 1
Answers by
William Hurst
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or