Support forums
in

How does the StyleDropDown work? (attaching styles to it)

Last post 12-10-2004, 10:14 AM by Adam. 11 replies.
Sort Posts: Previous Next
  •  07-14-2004, 10:47 AM 1250

    How does the StyleDropDown work? (attaching styles to it)

    I notice that there is a STYLE menu and a PARAGRAPH menu.
     
    The PARAGRAPH menu seems to add HTML tags.
     
    The STYLE menu appears to add FONT tags.
     
    How do I add CLASS attributes to items for CSS?
     
    For instance, I'd like people to be able to select a table, and add a "dataTable" class to the table tag. Or a snippet of text and have it wrapped in <span class="date"></span> tags. Is that doable with this product?
  •  07-14-2004, 11:17 AM 1251 in reply to 1250

    Re: How does the StyleDropDown work? (attaching styles to it)

    Actually, I just played with the STYLE menu in your forums here. It seems to work that way...I can select a table, choose a style, and then have it apply a class to that table.

     
    Cool!
     
    So, two questions:
     
    1) Where do the style names and classes come from to populate the menu?
    2) When selecting text, is there a way to have the style class attribute applied via a different tag than FONT?
     
     
  •  07-14-2004, 12:06 PM 1252 in reply to 1251

    Re: How does the StyleDropDown work? (attaching styles to it)

     Aluminum wrote:
    1) Where do the style names and classes come from to populate the menu?
    You can populate the menu yourself by grabbing the wanted dropdownlist and adding whatever items you want.
         Editor1.StyleDropDown.Items.Add("Text", "Value");
    Where "Text" is what will appear in the DropDownList and "Value" is the name of the class (so that class name must be defined in a style sheet that is linked to the page)
     
     Aluminum wrote:
    2) When selecting text, is there a way to have the style class attribute applied via a different tag than FONT?
    I'm not sure if the CuteEditor has anything like this but if you want to make a custom DropDown to do something similar then check out http://www.cutesoft.net/Forums/ShowPost.aspx?PostID=1196 near the bottom where Adam gave me some code that you can probably change to fit your need.
  •  07-14-2004, 1:53 PM 1253 in reply to 1252

    Re: How does the StyleDropDown work? (attaching styles to it)

    Where "Text" is what will appear in the DropDownList and "Value" is the name of the class (so that class name must be defined in a style sheet that is linked to the page)
     
    I'd only need the CSS file if I wanted people to be able to SEE the style, correct? They could still apply the class as long as I add the item to the list, correct?
     
    I'll look at that other code as well. Thanks!
     
    -Darrel
  •  11-24-2004, 8:11 PM 2563 in reply to 1252

    Re: How does the StyleDropDown work? (attaching styles to it)

    I try your approach but it fails.
    I'm only using a trial version.


    CS0117: 'CuteEditor.Editor' does not contain a definition for 'StyleDropDown'
    Source Error:
    Line 31:    Editor1.Text = "Type Here";
    Line 32:    Editor1.StyleDropDown.Items.Add(new ListItem("Style 1","Heading"));

    What am I doing wrong?
    Thanks,
    Steve
  •  11-25-2004, 5:27 AM 2566 in reply to 2563

    Re: How does the StyleDropDown work? (attaching styles to it)

    [ce v3.0]

    Hi, I´m using the StyleDdl as:

    DropDownList sddl = new DropDownList();
    sddl .Items.Add( new ListItem( "Border Solid Black","ceBorderSolidBlack" ) );
    ... more items here ...
    this.ce1.StyleDropDown = sddl ;

    Then in my webpage I need the associated class as:

    .ceBorderSolidBlack{ border: black1pxsolid; }
    Regards,
    »»» KenA
  •  11-25-2004, 6:09 AM 2569 in reply to 2566

    Re: How does the StyleDropDown work? (attaching styles to it)

    No joy yet.

    And when I look at the documentation it doesn't even contain a property for StyleDropDown... I only downloaded the CuteEditor for .NET yesterday... I wonder if I'm using a different version to many of the references in this forum??
    Thanks,
    Steve
  •  11-25-2004, 7:13 AM 2570 in reply to 2569

    Re: How does the StyleDropDown work? (attaching styles to it)

     enderwiggen wrote:

    ... I wonder if I'm using a different version to many of the references in this forum?? ...

    Please specify the version you are using, because ce v3.0 and ce v4.0 are different in the way you deal with the style ddl.

    Regards,
    »»» KenA
  •  11-25-2004, 11:17 AM 2572 in reply to 1250

    Re: How does the StyleDropDown work? (attaching styles to it)

    Dear All:
     
    Happy Thanksgiving Day !

    The CuteEditor 4.0 move many control from the Editor.ControlName to the Configuration file.

    So , the CssClass/CssStyle is just defined in the configuration file (including the command name)

    When you want to get the control by programming ,

    You could use this code :

    C#CuteEditor.ToolControl toolctrl=Editor1.ToolControls["CssStyle"];

    if the "CssStyle" is defined in the Full.config specify by the Editor1.AutoConfigure ,

    you could get the control using expression "toolctrl.Control" . for the dropdown , the control type is CuteEditor.RichDropDownList , so you could do this :

    C#if(!IsPostBack)
    {
        CuteEditor.ToolControl toolctrl=Editor1.ToolControls["CssStyle"]; 
        if(toolctrl!=null)
        {
            CuteEditor.RichDropDownList rddl=(CuteEditor.RichDropDownList)toolctrl.Control;
            //Items.Add(html,text,value);
            rddl.Items.Add("<b>bold text</b>","*bold text*","font-weight:bold");
        }
    }

     
    Regards , Terry .
  •  12-01-2004, 11:30 AM 2747 in reply to 2572

    Re: How does the StyleDropDown work? (attaching styles to it)

    very elegant :-D

  •  12-10-2004, 6:49 AM 2959 in reply to 2747

    Re: How does the StyleDropDown work? (attaching styles to it)

    I tried to edit the "Highlight" class so that the background-color was green. I did this by editing the class definition in example.css but the text was still highlighted in yellow. What am I doing wrong ?
     
    I could edit common.config and change the appearance of the Highlight dropdown - that was OK.
  •  12-10-2004, 10:14 AM 2961 in reply to 2959

    Re: How does the StyleDropDown work? (attaching styles to it)

     
    Please try the following steps:
     
    1. Edit the common.config and change the appearance of the Highlight dropdown  ( you've done this )
     
    2. Opent the CuteEditor/Template.aspx and modify the following code:
     
    .Highlight
      {
         background-color: yellow;
      }
     
    Please note that you can remove all the classes in the Template.aspx  and use the Editor.TemplateStyleSheet Property to specify the location of the style sheet that will be used by the editable area.

    For example: <CE:Editor id="Editor1" runat="server" TemplateStyleSheet ="~/example.css"></CE:Editor>
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems