Rad Menu - Skins

4 posts, 0 answers
  1. Manish
    Manish avatar
    3 posts
    Member since:
    Jul 2010

    Posted 22 Jul 2010 Link to this post

    Hi,

    I am using telerik control (RAD menu) skin.We are creating the menu dynamically and applying skin at item_databound. When the page is loaded first time the skin is not being applied. When the page is refreshed everything seems to be working fine. Please suggest a solution.

    ///Applying Skin

     

    protected override void CreateChildControls()

     

    {

     

    try

     

    {

    listname =

    ConfigurationManager.AppSettings["sitemenulist"] ?? defaultSiteMenuList;

     

     

    List<BallMenu> sitemenu = GetMenu();

     

     

    if (sitemenu.Count == 0)

     

    {

     

    var lblMenu = new Label {Text = "No items found in " + listname};

     

    Controls.Add(lblMenu);

    }

     

    else

     

    {

     

    var ballsiteroot = new RadMenu();

     

    ballsiteroot.DefaultGroupSettings.OffsetY = 6;

    ballsiteroot.Skin = vista;

    ballsiteroot.EnableEmbeddedSkins =

    false;

     

    ballsiteroot.EnableTheming =

    true;

     

    ballsiteroot.ItemDataBound += ballsiteroot_ItemDataBound;

    ballsiteroot.DefaultGroupSettings.ExpandDirection =

    ExpandDirection.Down;

     

    ballsiteroot.DefaultGroupSettings.RepeatColumns = 2;

    ballsiteroot.DataTextField =

    "Text";

     

    ballsiteroot.DataNavigateUrlField =

    "Url";

     

    ballsiteroot.DataFieldID =

    "ID";

     

    ballsiteroot.DataFieldParentID =

    "ParentID";

     

    ballsiteroot.DataSource = sitemenu;

    ballsiteroot.DataBind();

    Controls.Add(ballsiteroot);

    }

     

    base.CreateChildControls();

     

    }

     

    catch (Exception ex)

     

    {

    Log.Error(

    "Failed to create RadMenu control", ex);

     

     

    throw;

     

    }

    }


    ///Creating menu item dynamically

     

    private List<BallMenu> GetMenu()

     

    {

     

    int cacheTime;

     

     

    if (!Int32.TryParse(ConfigurationManager.AppSettings["BallSitesCachetime"], out cacheTime))

     

    {

    cacheTime = defaultBallSitesCacheTime;

    }

     

    var gotostrut = new GotoMenu(listname);

     

     

    List<BallMenu> sitemenu;

     

     

    object cacheItem = HttpRuntime.Cache[strUserNamecache];

     

     

    if (cacheItem == null)

     

    {

    sitemenu = gotostrut.GenerateSiteData();

     

    HttpRuntime.Cache.Insert(strUserNamecache, sitemenu, null, DateTime.Now.AddMinutes(cacheTime), TimeSpan.Zero);

     

    }

     

    else

     

    {

    sitemenu = (

    List<BallMenu>) cacheItem;

     

    }

     

    return sitemenu ?? new List<BallMenu>();

     

    }

     

    private void ballsiteroot_ItemDataBound(object sender,

     

     

    RadMenuEventArgs e)

     

    {

     

    try

     

    {

     

     

    var head = (string) DataBinder.Eval(e.Item.DataItem, "Text");

     

     

    string[] arr = head.Split(',');

     

     

    if (arr.Length > 1)

     

    {

     

    if (arr[1] == "1")

     

    {

     

    if (arr[0] == "&nbsp;")

     

    {

    e.Item.CssClass =

    "Blue1";

     

    e.Item.Text = arr[0];

    e.Item.Enabled =

    false;

     

    e.Item.Width = 166;

    }

     

    else

     

    {

    e.Item.CssClass =

    "Blue3";

     

     

    FontInfo fontinfo = e.Item.Font;

     

    fontinfo.Name =

    "Verdana";

     

    fontinfo.Bold =

    true;

     

    fontinfo.Size = 8;

    e.Item.ForeColor =

    Color.Black;

     

    e.Item.Text = arr[0];

    e.Item.Enabled =

    false;

     

    }

    }

    }

     

    else

     

    {

     

    if ((int) DataBinder.Eval(e.Item.DataItem, "ID") != 1)

     

    {

    e.Item.Attributes.Add(

    "onmouseover", "this.style.textDecoration = 'underline';this.style.cursor='hand';this.style.color='#0096BD';");

     

    e.Item.Attributes.Add(

    "onmouseout", "this.style.textDecoration = 'none';this.style.cursor='pointer';this.style.color='#000';");

     

    e.Item.CssClass =

    "Blue1";

     

     

    FontInfo fontinfo = e.Item.Font;

     

    fontinfo.Name =

    "Verdana";

     

    fontinfo.Size = 8;

    e.Item.Width = 166;

    }

     

    else

     

    {

    e.Item.CssClass =

    "Blue";

     

     

    FontInfo fontinfo = e.Item.Font;

     

    fontinfo.Name =

    "Verdana";

     

    fontinfo.Bold =

    true;

     

    e.Item.ExpandedCssClass =

    "BlueOtherStates";

     

    e.Item.FocusedCssClass =

    "BlueOtherStates";

     

    }

    }

    }

     

    catch (Exception ex)

     

    {

    Log.Error(

    "Failed to applying styles for item " + e.Item.Text, ex);

     

     

    throw;

     

    }

    }

  2. George
    Admin
    George avatar
    1332 posts

    Posted 27 Jul 2010 Link to this post

    Hi Manish,

    Thank you for contacting us.

    Your code looks fine. If you could give us a sample running project that reproduces the issue it would be very helpful.

    I will be glad to assist you further.

    Kind regards,
    George
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Manish
    Manish avatar
    3 posts
    Member since:
    Jul 2010

    Posted 30 Jul 2010 Link to this post

    Please see the CSS we are applying for this:

    .RadMenu

     

    .rmText

     

    {

     

    float:none !important;

     

     

    }

     

    .rmText .rmVertical .rmGroup .rmLevel1 .rmHorizontal .rmRootGroup

     

    {

     

     

    padding : 4px 4px 0px 14px;

     

     

    }

     

    .RadMenu_Vista .Blue

     

    {

     

    font-size:11px !important;

     

     

    background: url('/_layouts/images/BallTheme/rightTabUnS.gif') no-repeat left bottom !important ;

     

     

    text-decoration:none;

     

     

    color: black;

     

     

    line-height: 13px !important;

     

     

    vertical-align:bottom !important;

     

     

    padding-bottom:1px !important;

     

    }

     

     

    .RadMenu_Vista .Blue8

     

    {

     

     

    background: url('/_layouts/images/BallTheme/rightTabUnS.gif') no-repeat right bottom !important ;

     

     

    text-decoration:none;

     

     

    color: black;

     

     

    line-height: 13px !important;

     

    }

     

     

    .RadMenu_Vista .Blue:hover

     

    {

     

    background: url('/_layouts/images/BallTheme/rightTab.gif') no-repeat left bottom !important;

     

     

    color: black;

     

     

    vertical-align:bottom !important;

     

     

    line-height: 13px !important;

     

    }

     

     

    .RadMenu_Vista .BlueOtherStates

     

    {

     

    vertical-align:bottom !important;

     

     

    /*background: #a7cfe8 !important; */

     

     

    background: url('/_layouts/images/BallTheme/rightTabUnS.gif') no-repeat left bottom !important ;

     

     

    color: black;

     

     

    line-height: 13px !important;

     

    }

     

     

    .RadMenu .rmSlide

     

    {

     

    float:none !important;

     

     

    left:-248px !important;

     

     

    }

     

     

    .RadMenu .rmLink

     

    {

     

    width:100px;

     

    }

     

     

    .RadMenu .rmGroup .rmText

     

    {

     

    padding-left:15px !important;

     

     

    padding-right:15px !important;

     

     

    margin:0px 0px 0px 0px !important;

     

     

    }

     

     

     

    .RadMenu_Vista .Blue1

     

    {

     

    background-color: #DFF2F6 !important ;

     

     

    text-decoration:none;

     

     

    color: black;

     

     

    line-height: 15px !important;

     

     

    font-weight:normal;

     

     

    padding-left:0px !important;

     

     

    text-align:left !important;

     

     

    }

     

     

    .RadMenu_Vista .Blue3

     

    {

     

    background-color: #DFF2F6!important ;

     

     

    font-weight:bold;

     

     

    text-decoration:none;

     

     

    color: #000;

     

     

    line-height: 20px !important;

     

     

    }

     

     

    .RadMenu_Vista .Blue2

     

    {

     

    background-color:#DFF2F6 !important ;

     

     

    text-decoration:underline;

     

     

    color: #0096BD;

     

     

    font-weight:normal;

     

     

    line-height: 15px !important;

     

     

    padding-left:0px !important;

     

     

    text-align:left !important;

     

    }

     

     

    .RadMenu_Vista .expandBottom

     

    {

     

    padding-left:0px !important;

     

     

    text-align:left !important;

     

    }

     

     

     

    .ball-focused

     

    {

     

    background-color:#DFF2F6;

     

    }

    /* GOTO Syles */

  5. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 03 Aug 2010 Link to this post

    Hello Manish,

    This forum is for RadMenu for Silverlight. If you want to get proper response, please, post your question in the forum for RadMenu for ASP.NET.

    Sincerely yours,
    Valeri Hristov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top