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

[Solved] How to make some items clickable and some not?

1 Answer 97 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
al
Top achievements
Rank 1
al asked on 24 Jan 2011, 05:17 AM
Hello everyone,

I wish to make some items in the menu clickable and some not.
<%= Html.Telerik().Menu()
        .Name("Menu")
        .BindTo(Model.applicationMenu, mappings => 
        {
            mappings.For<ApplicationsMenu>(binding => binding
                    .ItemDataBound((item, applicationMenu) =>
                    {
                        item.Text = applicationMenu.MenuName;
                        item.Url = VirtualPathUtility.ToAbsolute("~/") + applicationMenu.MenuTarget;
                    })
                   );
        })
%>
In this case if the menuTarget is empty, then i do not want the link to be clickable.
I tried putting the setting of the item.Url in an if statement but it did not work too.

Thank you.


1 Answer, 1 is accepted

Sort by
0
al
Top achievements
Rank 1
answered on 24 Jan 2011, 05:36 AM
its all good .

item.Url =(applicationMenu.MenuTarget != "")? VirtualPathUtility.ToAbsolute("~/") + applicationMenu.MenuTarget:"#";

Setting the item.Url to # makes the it unclickable
Tags
Menu
Asked by
al
Top achievements
Rank 1
Answers by
al
Top achievements
Rank 1
Share this question
or