My RadMenu does not have cursor defined, so it always shows the regular cursor when hovered over a menu item. I want to change it to pointer (hand) on hover. I cannot do it from the css because not all items have url tied to them, especially the ones that have child nodes tied to them. Here's my xml example.
As you can see, Products, Usage, and Region don't have urls tied to them. So when user hovers on them, I want the cursor to be the default one, but when they hover on others, eg. Product1-3, Asia, or Eurpoe, I want the cursor to turn to pointer (hand).
What is the best way I can achieve this?
This is what I currently have. It is on server-side. However, I think client-side approach will be better.
Thanks.
| <Menu> |
| <Group Flow="Vertical"> |
| <Item Text="Products"> |
| <Group> |
| <Item Text="Product1" Href="~/Product1.aspx" Value="Product1" /> |
| <Item Text="Product2" Href="~/Product2.aspx" Value="Product2" /> |
| <Item Text="Product3" Href="~/Product3.aspx" Value="Product3" /> |
| </Group> |
| </Item> |
| <Item Text="Usage"> |
| <Group> |
| <Item Text="Region"> |
| <Group> |
| <Item Text="Asia" Href="~/Asia.aspx" Value="Asia" /> |
| <Item Text="Europe" Href="~/Europe.aspx" Value="Europe" /> |
| </Group> |
| </Item> |
| </Group> |
| </Item> |
| </Group> |
| </Item> |
As you can see, Products, Usage, and Region don't have urls tied to them. So when user hovers on them, I want the cursor to be the default one, but when they hover on others, eg. Product1-3, Asia, or Eurpoe, I want the cursor to turn to pointer (hand).
What is the best way I can achieve this?
This is what I currently have. It is on server-side. However, I think client-side approach will be better.
| foreach (RadMenuItem rmItem in rmMenu.Items) |
| { |
| ChangeCursorStyle(rmItem); |
| } |
| private void ChangeCursorStyle(RadMenuItem rmItem) |
| { |
| if (!String.IsNullOrEmpty(rmItem.NavigateUrl)) |
| rmItem.Style.Add("cursor", "pointer"); |
| foreach (RadMenuItem item in rmItem.Items) |
| { |
| ChangeCursorStyle(item); |
| if (!String.IsNullOrEmpty(item.NavigateUrl)) |
| { |
| item.Style.Add("cursor", "pointer"); |
| } |
| } |
Thanks.