M
MikeB
Hello All, I have UserControl that consists of a Menu control. When a user
selects an item in the Menu I set a Public variable in the MenuItemClick
event. My problem is that when the main webpage posts back, the
MenuItemClick isn't fired off until after the postback so I can not get it
and my SelectedCategoryID is always 0. Can anyone tell me what I am doing
wrong? Below are snippets of my code:
MENU.ascx
private int _CategoryID = 0;
protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
{
_CategoryID = Convert.ToInt32(e.Item.Value);
}
public int SelectedCategoryID
{
get
{
return _CategoryID;
}
}
Then in my webpage, I have something that checks for the Menu
if (Menus1.SelectedCategoryID != 0)
{}
else
{}
selects an item in the Menu I set a Public variable in the MenuItemClick
event. My problem is that when the main webpage posts back, the
MenuItemClick isn't fired off until after the postback so I can not get it
and my SelectedCategoryID is always 0. Can anyone tell me what I am doing
wrong? Below are snippets of my code:
MENU.ascx
private int _CategoryID = 0;
protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
{
_CategoryID = Convert.ToInt32(e.Item.Value);
}
public int SelectedCategoryID
{
get
{
return _CategoryID;
}
}
Then in my webpage, I have something that checks for the Menu
if (Menus1.SelectedCategoryID != 0)
{}
else
{}