473,699 Members | 2,431 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

I have menu bound to sitemap file.
This is a piece of code
<asp:menu ... >
<StaticItemTemp late>
<%# ((MenuItem)Cont ainer.DataItem) .Selected ? [Show 'selected'-styled
decoration] : [Show plain-styled decoration] %>
</StaticItemTempl ate>
</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 <StaticItemTemp latealready rendered and element is
shown unselected :(
Feb 4 '08 #1
2 1992
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...
Feb 4 '08 #2
Maybe I should make something like this
((MenuItem)Cont ainer.DataItem) .Selected ||
IsThisSelected( (MenuItem)Conta iner.DataItem) ? ....

:)
Feb 4 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1115
by: iffy agbim | last post by:
I have a form that displays information selected from an Access Data base. A select statement is used to do this on my asp page SQLQuery = "SELECT * FROM tblopgaCOm2 WHERE billNo = '" & Request.Form("BILLNO") & "' AND area LIKE 'AUDIT'" billNo and area are the 2 fields used together to make the record we need unique. example Bill d456(billNo) can be assigned to various depts(area). as many depts as it is assigned rep the many...
5
1533
by: Hunter Pieper | last post by:
Hello, We are trying to get an .asp page to post to an access database. the page is viewable, and the form boxes can be filled in. Upon submission of the data a confirmation page is then to show. What happens is the data is inserted into the page, but upon submission an HTTP 500 Internal server error appears.
2
1708
by: Nathan Sokalski | last post by:
I have several DropDownList controls on my page that use databinding. However, I want to give users the option of selecting a choice such as "None Selected" or something else that shows they did not make a selection. However, if I attempt to add a ListItem to the Items collection when databinding is used it is removed and replaced by the item in the databinding source. Is there any simple way to add an extra ListItem, or do I have to build...
3
2130
by: Joao Batista | last post by:
Hi all, I have a MasterPage with a menu, populated from a database, my problem now is when i chose an option , how can i pass (catch) the value to my products page??? Thanks Joao Batista
9
4841
by: Tristán White | last post by:
Hi I am very new to PHP - actually, this is my second day at it, as I've only recently started a new job last week. We're a charity. I have a "No input file selected" problem. A Google search has shown me that this is a common problem, but I have tried to follow all the various instructions but none of them make any difference. First of all... Some background on the page it links from.....
5
6176
by: Brad Isaacs | last post by:
Good morning friends, I am working with ASP.NET 2.0 -- VB code behind I have created tabbed pages using the Menu control with the Multiview control. Using the menu control to display the tabs, and the Multiview control to display the content that corresponds to the selected tab. My Menu control needs to be able to switch language from English or French depending on the language chosen by the user.
0
1152
by: toddwerts | last post by:
I have an aspx page with some form controls in it. They all work fine except for one thing, the control (list) that is populated based on the selected item in the first control (dropdownlist1) is only showing the element ID, not the "name" which I want. So, I think I just need a pretty simple join query to get the name property. I need to get the Capability name (capability_name) from the Capability Table where the capabilityid in the...
3
5352
by: kenny bones | last post by:
Hi! I'm currently working on a menu which is based on CSS and is listed with <li> tags. The CSS code looks like this: #nav { position: absolute; top: 101px; left: 390px; list-style: none; margin: 0; padding: 0;
0
3568
by: rehanmomin | last post by:
Just to start off, I am writing a web application using C#. I have a Menu which is binded to an XML datasource. There are three menu items each with submenus and a textbox where I want to display the value of the selected menu item. Heres the XML datasource that I am using: <?xml version="1.0" encoding="utf-8" ?> <Home> <Menu text="Patient" description=" "> <SubMenu text="First Name" description="firstName"></SubMenu> ...
0
8687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9034
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8914
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8883
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7750
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6534
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5874
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.