+1-888-365-2779
Try Now
More in this section

Forums / Designing with Sitefinity / Putting a Break in a Menu Item

Putting a Break in a Menu Item

6 posts, 0 answered
  1. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    22 Sep 2009
    Link to this post
    In order to have my horizontal menu items break on to two lines, I think I have to have something like this:

    .RadMenu {

     

    white-space:normal !important;}

    Using my own menu skins....  this works, but my menu items will only break if I put a width on the .rmitem class giving each menu item a fixed width.       Can I get this to work if I don't want a fixed width for each menu item?

    For instance if my menu items are:

    About     My              Andersons                  Contact
    Me         Career        Recommendations      Me

    How can I programatically set it so each item may be a different width??? 

    Thank you in advance!

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    22 Sep 2009
    Link to this post
    Hello Laura,

    You can set the width programmatically after subscribing for RadMenu's ItemDataBound event. Sample code is shown below:

     public void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e) 
        { 
                CmsSiteMapNode siteNode = e.Item.DataItem as CmsSiteMapNode; 
                if (siteNode != null
                { 
                    // here you can get a certain RadMenuItem 
                    e.Item.Width = System.Web.UI.WebControls.Unit.Pixel(50); 
     
                } 
         }    
          
     
    I think that RadTabStrip control will be more appropriate if you are going to break the items. By default the
    RadTab item supports break property. I hope that this helps.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    22 Sep 2009
    Link to this post
    Thank you for the code Ivan!
    RadTabStrip doesn't support drop downs like the RadMenu though???
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    22 Sep 2009
    Link to this post
    Hello Laura,

    Yes it does not support. It has some similar functionality as Tabs Preview.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    22 Sep 2009
    Link to this post
    I think your code below should work.
    Basically i want to find either an "&"  or the first ' ' (space) and insert a <br />

     
    So it would produce -
    "IMA <br /> Membership"
    OR
    "Groups & <br /> Networking"

    sorry, but do you have any quick code? Thank you!!
    --
    public void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e)
    {
     CmsSiteMapNode siteNode = e.Item.DataItem as CmsSiteMapNode;
     if (siteNode != null) {
      'e.Item.Width = System.Web.UI.WebControls.Unit.Pixel(50);

     

    'basically i want to find either an & or the first a ' ' (space) and insert a <br />

     

    ' IMA <br /> Membership
    'OR
    'Groups & <br /> Networking
    }
    }

     

  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    23 Sep 2009
    Link to this post
    Hello Laura,

    Below is sample code that illustrates getting the first item that has a "&" in the text.

        public bool find = false
        public void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e) 
        { 
         
     
                if (e.Item != null && e.Item.Text.Contains("&") && !find) 
                { 
                    // do something 
                    this.find = true
                } 
        } 


    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
6 posts, 0 answered