473,385 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Menu User Control & Postback

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
{}

Aug 9 '07 #1
0 1449

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

Similar topics

3
by: Cathie | last post by:
Hi All, I have a few user controls on a page and I need to determine which control caused the PostBack. Is there anyway to do this? Thanks in advance, Cathie
3
by: Ohad Young | last post by:
Hi, I have a frameset page that contains two frames: 1. the first frame, an aspx page, contains a menu for navigating in the website. 2. the second frame contains content, pdf, html or other...
5
by: Fuehner | last post by:
I have a masterpage define that contains a asp:menu control. My menu control has items that do not have a NavigateUrl assigned which causes them to postback on the current page... Now the issue...
9
by: Jay | last post by:
I have an asp menu control with menu items navigateUrl set to come back to the same aspx page but with different values in a url token. this works, but it is causing all my asp controls to loose...
8
by: Mats Lycken | last post by:
Hi, I'm working on a webproject where I have several different user controls loaded on a WebForm. A problem arises when I in one webcontrol makes a change that should be picked up by another user...
11
by: Rickie | last post by:
Dear fellow software engineers, Is the web menu in asp 2.0 essentielle a useless control ? How many people( including msdn itself) are using server menu controls? Its a menu which always...
0
by: John Smith | last post by:
If anyone can help, I would very muchly appreciate it. I have a main page that uses the .net 2.0 menu control with the multiview controls as the menu choices. This works fine. One of the menu...
6
by: clintonG | last post by:
I haven't learned this control yet but I do need to know if it can be configured to drop down instead of fly-out? // Like this... ------------------- Static Root Label -------------------...
2
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.