Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

How and where do i assign "Selected" to menuitem of asp:menu control     on page load?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
alexandis - 04 Feb 2008 12:16 GMT
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) ? ....

:)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.