Change default HTML output for a tool

4 posts, 0 answers
  1. William Hurst
    William Hurst avatar
    21 posts
    Member since:
    Mar 2010

    Posted 13 Jul 2012 Link to this post

    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?
  2. William Hurst
    William Hurst avatar
    21 posts
    Member since:
    Mar 2010

    Posted 17 Jul 2012 Link to this post

    Is this even possible? A nudge in the right direction will help as well.
  3. Rumen
    Admin
    Rumen avatar
    14420 posts

    Posted 17 Jul 2012 Link to this post

    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.
  4. William Hurst
    William Hurst avatar
    21 posts
    Member since:
    Mar 2010

    Posted 14 Aug 2012 Link to this post

    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);
    }
    }
Back to Top