473,385 Members | 1,942 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 - Pass Value

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
Mar 17 '06 #1
3 2115
Hi Joao,

You need to get a reference to the master page using FindControl and with
that, get a reference to the menu. The menu reference should give you its
select item name or id.

Here's where to start:

http://msdn2.microsoft.com/en-us/lib...f0(VS.80).aspx

Ken
Microsoft MVP [ASP.NET]

"Joao Batista" <teste@iol,pt> wrote in message
news:uP**************@TK2MSFTNGP10.phx.gbl...
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

Mar 17 '06 #2
Hi Ken,
i'm a newbie here, I know that (and i can get the reference to the menu),
but i don't know how to get reference to the selected item, have you some
example where i can see that.

Thank's

Joao Batista
"Ken Cox - Microsoft MVP" <BA**********@hotmail.com> escreveu na mensagem
news:%2******************@tk2msftngp13.phx.gbl...
Hi Joao,

You need to get a reference to the master page using FindControl and with
that, get a reference to the menu. The menu reference should give you its
select item name or id.

Here's where to start:

http://msdn2.microsoft.com/en-us/lib...f0(VS.80).aspx

Ken
Microsoft MVP [ASP.NET]

"Joao Batista" <teste@iol,pt> wrote in message
news:uP**************@TK2MSFTNGP10.phx.gbl...
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


Mar 17 '06 #3
Here's the master:

<%@ Master Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
{
Label mpLabel;
mpLabel= (Label)this.ContentPlaceHolder1.FindControl("Label 1");
if (mpLabel != null)
{
mpLabel.Text = Menu1.SelectedItem.Text;
}
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Menu Master</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:menu id="Menu1" runat="server" orientation="Horizontal"
onmenuitemclick="Menu1_MenuItemClick">
<items>
<asp:menuitem text="Colour" value="Colour">
<asp:menuitem text="Red" value="Red"></asp:menuitem>
<asp:menuitem text="Green" value="Green"></asp:menuitem>
<asp:menuitem text="Blue" value="Blue"></asp:menuitem>
</asp:menuitem>
<asp:menuitem text="Animal" value="Animal">
<asp:menuitem text="Dog" value="Dog"></asp:menuitem>
<asp:menuitem text="Cat" value="Cat"></asp:menuitem>
<asp:menuitem text="Pig" value="Pig"></asp:menuitem>
</asp:menuitem>
</items>
</asp:menu>
</div>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</form>
</body>
</html>

Here's the page:

<%@ Page Language="C#" MasterPageFile="~/menu.master" Title="Catch Menu" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<br />
<asp:label id="Label1" runat="server" text="Label"></asp:label>
</asp:Content>
When the menu is selected. it finds the contentplaceholder and the label and
sets the text.

Okay?

Ken

"Joao Batista" <teste@iol,pt> wrote in message
news:OM**************@TK2MSFTNGP10.phx.gbl...
Hi Ken,
i'm a newbie here, I know that (and i can get the reference to the menu),
but i don't know how to get reference to the selected item, have you some
example where i can see that.

Thank's

Joao Batista
"Ken Cox - Microsoft MVP" <BA**********@hotmail.com> escreveu na mensagem
news:%2******************@tk2msftngp13.phx.gbl...
Hi Joao,

You need to get a reference to the master page using FindControl and with
that, get a reference to the menu. The menu reference should give you its
select item name or id.

Here's where to start:

http://msdn2.microsoft.com/en-us/lib...f0(VS.80).aspx

Ken
Microsoft MVP [ASP.NET]

"Joao Batista" <teste@iol,pt> wrote in message
news:uP**************@TK2MSFTNGP10.phx.gbl...
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



Mar 18 '06 #4

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

Similar topics

4
by: John | last post by:
Could anyone please help me on this?? I have a php script page, which is basically quiz. Visitors (after login in with their email address) are supposed to answer each question, and when they...
1
by: Bizt | last post by:
Hi, I would like to create a menu where the menu options were taken from an XML file. The reason is that I would be able to update the xml file (by simply adding new child nodes) after I...
11
by: rigga | last post by:
Hi, I am trying to code a menu for a webpage, the menu is broken up to groups i.e: Home Group1  menuitem1  menuitem2  menuitem3
3
by: Sharon | last post by:
Hi y'all, I'm trying to figure out how to tackle this problem: I have an XML table with a cool grid in which users can select a table row. When they right-click on a cell, they get a modal dialog...
7
by: Chuck Hartman | last post by:
I have a Windows service that requests web pages from a site using an HttpWebRequest object. When I try to request a page from an ASP.NET 2 site, I get a WebException with message "The remote...
2
by: elziko | last post by:
I understand how to edit the registry to add context menu items in windows for any file type. I know I can use %1 for the default value of the command key to signify the filename that has been...
3
by: scaredemz | last post by:
hi, so i'm creating a dynamic drop-down menu. the menu and the text show up fine in IE but only the drop-down shows in Firefox without the menu text. Below is the fxn code. help pls. function...
1
by: platostoteles | last post by:
Hallo NG, I am new to JavaScript and would really appreciate any help to solve my problem. I am using the blow code in my form to validate form fields. What I would like to accomplish is that...
2
by: tamasu | last post by:
Hi, I am retrieving a selected item from a list/menu component on an HTML page. The said value is passed as a parameter to a method initiated through <jsp:useBean. I am aware that when...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...

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.