I have menu bound to sitemap file.
This is a piece of code
<asp:menu ... >
<StaticItemTemplate>
<%# ((MenuItem)Container.DataItem).Selected ? [Show 'selected'-styled
decoration] : [Show plain-styled decoration] %>
</StaticItemTemplate>
</asp:menu>
I check properties of menu items in my method and based on it decide,
which element should be shown selected.
The problem is when I try to determine this before databinding event,
menu still does not have items and impossible to find out, what should
be selected. When I try to determine this AFTER databinding, it's too
late, because <StaticItemTemplate> already rendered and element is
shown unselected :(
alexandis - 04 Feb 2008 12:20 GMT
Specifying:
when I CLICK some menu item (i.e. do postback) - everything is ok,
this item is shown selected without any code.
But i also need to select some default menu item on start up, when
just being redirected from login page.
This piece DOESN'T work...
alexandis - 04 Feb 2008 12:26 GMT
Maybe I should make something like this
((MenuItem)Container.DataItem).Selected ||
IsThisSelected((MenuItem)Container.DataItem) ? ....
:)