How to pass command argument while selecting a Menu Item in System.Web.UI.WebControls.Menu
I have a Menu. When user clicks on the menu , I need to pass a command argument. How is that done ?
This is the code for
<asp:Menu ID="NoticeManagerMenu" runat="server" Orientation="Horizontal" OnMenuItemClick="NoticeManagerMenu_MenuItemClick">
<StaticMenuStyle HorizontalPadding="0px" VerticalPadding="0px" />
<StaticMenuItemStyle BackColor="#C0C0FF" />
<StaticSelectedStyle BackColor="#C0C0FF" BorderColor="#C0C0FF" />
<StaticHoverStyle BackColor="Silver" />
<Items>
<asp:MenuItem Text="List"></asp:MenuItem>
<asp:MenuItem Text="Insert"></asp:MenuItem>
</Items>
</a开发者_如何转开发sp:Menu>
In the code behind, I wish to use like this
protected void NoticeManagerMenu_MenuItemClick(object sender, MenuEventArgs e)
{
if (e.CommandArgument.Equals("Update"))
{
}
else
{
}
}
Thanks in Advance..
CommandName
and CommandArgument
properties seem to be read-only. You might try to compare the Text
of your menu item.
Did you tried Value attribute?
http://msdn.microsoft.com/en-us/library/ecs0x9w5(v=VS.80).aspx
精彩评论