Customizing Wijmo C1Editor

Originally Posted 14 June 2014, 5:34 am EST

  • Originally Posted 14 June 2014, 5:34 am EST

    Hi all,
    I'm trying to remove some groups and buttons from the Wijmo C1Editor 4.0.20141.166. c# vs 2013.

    If I include the following in the PageLoad event
       
    c1Editor.RibbonUI.TabPages[0].Groups[0].Buttons.RemoveAt(2); // preview button
    c1Editor.RibbonUI.TabPages[0].Groups[1].Buttons.RemoveAt(4); // template button
    c1Editor.RibbonUI.TabPages[0].Groups[3].Buttons.RemoveAt(1); // Inspect button

    c1Editor.RibbonUI.TabPages[1].Groups.RemoveAt(3); // Special group
    c1Editor.RibbonUI.TabPages[1].Groups.RemoveAt(2); // forms group


    If works first time the page is displayed, however if I refresh the page the items return. The code runs whenever the page is loaded.

    I noticed that each time the page is loaded before the above code the count of items returns to the original, after the code above on the first load the count is reduced by the number of items I've removed and the control looks fine without the items. After the page refresh, the count has again returned to the original before the above code and after the code the count is reduced but the items are back on the ribbon.

    Is there something I'm doing wrong here.

    is there a better way (read working way) to customise the ribbon.

    Alternatively is there a way to add a save button to the simple toolbar.

    Cheers...
    Adrian
  • Reply

    Hello Adrian,

    Please try using this code in using IsPostBack method :
    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
    {
    //your code
    }
    }


    Let me know if this helps.

    Thanks,
    Richa
  • Reply

    Hi there,
    I tried that but it didn't help. I've attached a small sample that illustrates the issue. The webform has the editor and a button, upon first viewing the ribbon is correctly tailored (i.e. missing the icons). Click the button to get a post back and when the form reappears the icons are back.

    Adrian.
    2014/06/TestWijmoEditor.zip
  • Reply

    Hello Adrian,

    If you want the code ot be retained, please use the code in Page_Init event without the IsPostBack method as given in the following code:
     protected void Page_PreInit(object sender, EventArgs e)
    {

    C1Editor1.RibbonUI.TabPages[0].Groups[0].Buttons.RemoveAt(2); // preview button
    C1Editor1.RibbonUI.TabPages[0].Groups[1].Buttons.RemoveAt(4); // template button
    C1Editor1.RibbonUI.TabPages[0].Groups[3].Buttons.RemoveAt(1); // Inspect button

    C1Editor1.RibbonUI.TabPages[1].Groups.RemoveAt(3); // Special group
    C1Editor1.RibbonUI.TabPages[1].Groups.RemoveAt(2); // forms group
    }
    }


    Thanks,
    Richa
  • Reply

    Thanks richas,
    this works well.

    Adrian.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels