Migrating C1Menu from Web.UI to Web.Wijmo

Posted by: peo on 10 September 2017, 11:51 am EST

  • Posted 10 September 2017, 11:51 am EST

    I am migrating my project to Wijmo. Have problems with the C1Menu control.

    1. How to do this in Wijmo (If the selected menu item dont have a sub menu, then postback)?

    if (!item.hasMenuItems())
    __doPostBack('__Page', 'MyCustomArgument');

    2. How to set a max height of a sub menu and that a scrollbar appear when the item don't fit in the set height.

    3. How to set the width of a sub menu.

    All these was no problem in the web.ui version, but I can't find out how to do it i Wijmo.

    Thanks in advance.
  • Replied 10 September 2017, 11:51 am EST


    Regarding the first issue, you can force a postback from client side if the menu doesn't have child items. There is no such direct property for it. You may use the following client side script for the same.

    <script type="text/javascript">
    $(document).ready(function () {
    $("#C1Menu1").c1menu({ select: function (e, data) {
    //conditional postback
    if (data.item._items.length <= 0) {
    __doPostBack("__Page", "");
    else {
    return false;


    Regarding the 2nd and 3rd issues, you can use the css code to set the width and scrolling in the child items.
    [css]<style type="text/css">
    width: 200px !important;
    overflow: scroll !important;
    See attached sample for complete implementation.
    Hope this helps..!!
  • Replied 10 September 2017, 11:51 am EST

    I have tested your sample, but it does not behave as intended.

    The conditional postback works, but:

    1. The eventhandler C1Menu1_ItemClick never get called at the postback. (It is set up ok to the event)

    2. using css width sets the child menu width but when I add a second level of child menu the children at the next level is opened within that width an is hardly visible.

    3. using css height sets a fixed height, what I want is a max height (I have dynamically created child menus depending on user rights, for an administrator the menu can be higher than the screen and must be limited and have a scrollbar, but I dont want it to be that high when not neccessary).

Need extra support?

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

Learn More

Forum Channels