How to set session variable on a menu item's click in ASP.NET -


ASP Nosibi Here, in my website, I need to set session charge upon clicking on the menu item (not on page load) This pre init or init).

How can I get it, my master page has a menu control in which a sitemap file is attached?

How do know that a special menu item is clicked on?

  & lt; ASP: menu id = "main menu" run = "server" datasource id = "sitemaposource" staticdisplayleval = "10" width = "150px" & gt; & Lt; Static SelelectStyle CssClass = "menuNodeSelected" /> & Lt; LevelMenuItemStyles & gt; & Lt; Asp: MenuItemStyle font-bold = "true" font-underline = "false" /> & Lt; / LevelMenuItemStyles & gt; & Lt; StaticMenuItemStyle CssClass = "menuNode" /> & Lt; / ASP: Menu & gt; & Lt; Asp: SiteMapDataSource id = "siteMapSource" runat = "server" ShowStartingNode = "False" />    

Depending on your code and documentation on MSDN, you should have something like this: < Markup Code (the result of which will be sent to Customer )

   & Lt; LevelMenuItemStyles & gt; & Lt; Asp: MenuItemStyle font-bold = "true" font-underline = "false" /> & Lt; / LevelMenuItemStyles & gt; & Lt; StaticMenuItemStyle CssClass = "menuNode" /> & Lt; / ASP: Menu & gt; & Lt; Asp: SiteMapDataSource id = "siteMapSource" runat = "server" ShowStartingNode = "False" />   

You should set a method to call server side OnMenuItemClick , this will increase the occurrence of menu click. That event is (in our case): click the navigation menu / menu .

Code-Back You can do whatever you want when the menu item is selected.

  Zero NavigationManuUI ItemClick (Object Sender, MenuEventArgs E) {// Display the text of the menu item selected by the user. message. Text = "you selected" + e. ITEM Text + "."; Session ["variable"] = E. ITEM Text; }   

in e.Item.Text; You find which element is selected.

Based on:

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -