views:

19

answers:

1

I've been out of Asp.net WebForms for a while (been doing MVC for the last 2.5 years) and I obviously fell out of routine.

I would like to create a list of menu items using asp:MenuItem server controls. It all works fine, but I'd like to provide dynamic values for NavigateUrl properties:

<asp:MenuItem Text="Something" NavigateUrl="<%= /* some code */ %>" />

But I can't make my head to work around it. Nothing seems to work.

Edit

Beside the upper one I've also tried these two but with no luck either...

<asp:MenuItem Text="Something" NavigateUrl='<%= /* some code */ %>' />
<asp:MenuItem Text="Something" NavigateUrl="<%# /* some code */ %>" />

Anyone? Is this really that hard or what? Basically I don't want a static menu on my masterpage but a dynamic one. And I don't want to use any kind of data sources.

A: 

If you are going to have code specifying a property I think you need to use this:

<asp:MenuItem Text="Something" NavigateUrl='<%= /* some code */ %>' />

Note the single quotes. I know this is true in grids. Been a while as I am purely MVC now too.

Richard
Tried that already. Nope doesn't work. I've tried using the old trick of page data binding as well (`<%# %>`) that didn't work either (I've edited my question to include my tries)
Robert Koritnik