This is a migrated thread and some comments may be shown as answers.

Set Attributes of RadMenu

2 Answers 166 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 15 Apr 2012, 07:43 PM
I have a radmenu which i am binding on the code behind, I have been trying to find a way to disgin it as it want it via the html (No luck) and via the designer, but all my items are loaded programmatically.  What I want to do is set the height and width of all my menu items and then center the center height wise.  So for each item the width(200px), height(40px")  and the text vertical centered.  Tried via a css file but the code behind does no get it.

.Menuitems
    {
        width:200px;
        height:40px;
        cursor:pointer;
        font-size:16;
        text-align:center;
    }


Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
       If Not IsPostBack Then
           'Load the menu system
           sql = "Select intDirectoriteId, strDirectorite from tblDirectorite"
           myDataTable = New DataTable
           myDataTable = getData(sql)
           RadMenu1.DataSource = myDataTable
           RadMenu1.DataTextField = "strDirectorite"
           RadMenu1.DataValueField = "intDirectoriteId"
           RadMenu1.CssClass = "Menuitems"
           RadMenu1.DataBind()
       End If
   End Sub
   Protected Sub RadMenu1_ItemDataBound(sender As Object, e As Telerik.Web.UI.RadMenuEventArgs) Handles RadMenu1.ItemDataBound
       Dim row As DataRowView = CType(e.Item.DataItem, DataRowView)
       e.Item.ToolTip = row("strDirectorite") & " Applications".ToString
   End Sub

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 16 Apr 2012, 08:51 AM
Hi Kevin,

Try the following css to set height and width of RadMenuItems and to align the text in the center.

CSS:
<style type="text/css">
 .Menuitems .rmItem
   {
     width:200px !important;
     height:40px !important;
   }
 .Menuitems a.rmLink
   {
     text-align:center !important;
     padding-top:12px !important;
     padding-bottom:12px !important;
   }
 .Menuitems .rmText
   {
     float:none !important;
     font-size:16px !important;
   }
</style>

VB:
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
       If Not IsPostBack Then
           'Load the menu system
           sql = "Select intDirectoriteId, strDirectorite from tblDirectorite"
           myDataTable = New DataTable
           myDataTable = getData(sql)
           RadMenu1.DataSource = myDataTable
           RadMenu1.DataTextField = "strDirectorite"
           RadMenu1.DataValueField = "intDirectoriteId"
           RadMenu1.CssClass = "Menuitems"
           RadMenu1.DataBind()
       End If
End Sub

Hope this helps.

Regards,
-Shinu.

0
Kevin
Top achievements
Rank 1
answered on 16 Apr 2012, 07:51 PM
HI,
Ok had to take off the applied skin to get it to work correctly, otherwise it did not work so well.  Thanks for the help.
Tags
Menu
Asked by
Kevin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Kevin
Top achievements
Rank 1
Share this question
or