Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to know whether there will be a click event of menu control. because in my website i used menu control for displaying menus and i am displaying four alert panels below the menu control. here i want to display only three panels according to the click event of menu item will it possible.

//here this is the code

XML
<Items><asp:MenuItem Text="Home"></asp:MenuItem></Items>
       <Items><asp:MenuItem Text="About Us"></asp:MenuItem></Items>
       <Items><asp:MenuItem Text="Job Search"></asp:MenuItem></Items>
       <Items><asp:MenuItem Text="Discussion Forum"></asp:MenuItem></Items>
       <Items><asp:MenuItem Text="Career Resources"></asp:MenuItem></Items>
       <Items><asp:MenuItem Text="Login"></asp:MenuItem></Items>
       <Items><asp:MenuItem Text="Contact Us"></asp:MenuItem></Items>



//cs code

C#
protected void MenuLoginPage_MenuItemClick(object sender, MenuEventArgs e)
       {
           if (e.Item.Text == "Home")
           {
               panelTestimonials.Visible = false;
               MenuLoginPage.Items[0].NavigateUrl = "WelcomePage.aspx";
           }
           if (e.Item.Text == "About Us")
           {
               panelTestimonials.Visible = false;
               MenuLoginPage.Items[1].NavigateUrl = "aboutusdisplay.aspx";
           }
           if (e.Item.Text == "Job Search")
           {
               panelTestimonials.Visible = false;
               MenuLoginPage.Items[2].NavigateUrl = "job_search.aspx";
           }
           if (e.Item.Text == "Discussion Forum")
           {
               panelTestimonials.Visible = false;
               MenuLoginPage.Items[3].NavigateUrl = "carrerresources_display.aspx";
           }
           if (e.Item.Text == "Career Resources")
           {
               panelTestimonials.Visible = false;
               MenuLoginPage.Items[4].NavigateUrl = "carrerresources_display.aspx";
           }
           if (e.Item.Text == "Login")
           {
               panelTestimonials.Visible = false;
               MenuLoginPage.Items[5].NavigateUrl = "loginsection.aspx";
           }
           if (e.Item.Text == "Contact Us")
           {
               panelTestimonials.Visible = false;
               MenuLoginPage.Items[6].NavigateUrl = "contact_us.aspx";
           }

       }
Posted
Updated 6-Jan-13 21:16pm
v2

1 solution

Yes it is possible.

Is that only you want to know ?
 
Share this answer
 
Comments
ntitish 7-Jan-13 0:56am    
sir, for menu item also there will be a click event ....as like button
ntitish 7-Jan-13 0:58am    
why because i want to display the three alert panels out of four according to the menu item. is there any way........
[no name] 7-Jan-13 1:03am    
then post your code here and ask whatever you want properly :)
ntitish 7-Jan-13 1:28am    
//this is the code for menu controll

<asp:Menu ID="MenuLoginPage" runat="server" Orientation="Horizontal"
StaticMenuItemStyle-CssClass="menuUpper" StaticMenuItemStyle-BackColor="White"
BackColor="#CCCCCC" DynamicMenuItemStyle-BackColor="#CCCCCC"
onmenuitemclick="MenuLoginPage_MenuItemClick">
<items><asp:MenuItem Text="Home" NavigateUrl="~/WelcomePage.aspx">
<items><asp:MenuItem Text="About Us" NavigateUrl="~/aboutusdisplay.aspx">
<items><asp:MenuItem Text="Job Search" NavigateUrl="~/job_search.aspx">
<items><asp:MenuItem Text="Discussion Forum" NavigateUrl="~/carrerresources_display.aspx">
<items><asp:MenuItem Text="Career Resources" NavigateUrl="~/carrerresources_display.aspx">
<items><asp:MenuItem Text="Login" NavigateUrl="~/loginsection.aspx">
<items><asp:MenuItem Text="Contact Us" NavigateUrl="~/contact_us.aspx">


//by clicking on menu item "home" i want to display only three alert panels(JOB ALERTS,EVENTS,SITE ALERTS,NEWS ALERTS) out of four panels which are already on the LOGIN.MASTER PAGE how you are seeing on the current page of code project as like Your Filters,Top Experts In 24 Hours,Top Experts In one month.
ntitish 7-Jan-13 3:35am    
i updated my question now i think you will understand........

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900