c# - ASP:Menu.SelectedValue not working -



c# - ASP:Menu.SelectedValue not working -

i've been trying utilize asp:menu.selectedvalue property not working if has used before please read on. here code.

<asp:menu id="menu1" runat="server" backcolor="#b5c7de" dynamichorizontaloffset="2" font-names="verdana" font-size="0.8em" forecolor="#284e98" onmenuitemclick="menu1_menuitemclick1" staticsubmenuindent="10px" visible="false"> <dynamichoverstyle backcolor="#284e98" forecolor="white" /> <dynamicmenuitemstyle horizontalpadding="5px" verticalpadding="2px" /> <dynamicmenustyle backcolor="#b5c7de" /> <dynamicselectedstyle backcolor="#507cd1" /> <items> <asp:menuitem selectable="false" text="analysis" value="analysis"> <asp:menuitem selectable="false" text="descriptive" value="descriptive"> <asp:menuitem text="mean" value="mean"></asp:menuitem> <asp:menuitem text="median" value="median"></asp:menuitem> <asp:menuitem text="mode" value="mode"></asp:menuitem> </asp:menuitem> </asp:menuitem> </items> <statichoverstyle backcolor="#284e98" forecolor="white" /> <staticmenuitemstyle horizontalpadding="5px" verticalpadding="2px" /> <staticselectedstyle backcolor="#507cd1" /> </asp:menu>

and code behind

protected void menu1_menuitemclick(object sender, menueventargs e) { menuitem selecteditem = menu1.selecteditem; lblupload.text = menu1.selecteditem.text; if (menu1.selecteditem.text == "mean") { lblset.visible = true; dropdownlist1.visible = true; btncalculate.visible = true; } }

i added in line

lblupload.text = menu1.selecteditem.text;

to test output on visible , working label nil returning. can see problem this? have tested;

lblupload.text = selecteditem.text/.value; lblupload.text = menu1.selecteditem.value; lblupload.text = menu1.selecteditem.valuepath;

none of these impact label in anyway. there problems command in general or missing obvious mistake. appreciate feedback thanks.

this works create menu1 visible , alter onmenuitemclick="menu1_menuitemclick1" onmenuitemclick="menu1_menuitemclick".

i menu1 needs alter visibility please provide code shows how it.

edited:

try break downwards problem little pieces:

the problem might have error trying access selected menu item you might have problem displaying selected item in lblupload

the best way check set breakpoint @ menu1_menuitemclick, start debugging hitting f5 , have @ menu1.selecteditem.text there.

c# asp.net selectedvalue aspmenu

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -