Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. CSS menu change in Asp.net

CSS menu change in Asp.net

Scheduled Pinned Locked Moved ASP.NET
csharphelpquestionphpcss
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mark_me
    wrote on last edited by
    #1

    Hi, I am having problems with using css in asp.net. I was a php programmer about 3 yrs back, jumped into C# about 2 yrs back but worked with windows applications. Now i wish to work in asp.net. I have good C# knowledge, am using an asp.net book too but this problem, wasn't able to find any help. sorry, if my question is stupid... Actually, i remember in php, using a template on each page and for each page changin colors manually to show selected menu. With asp.net and master pages, i have used CSS to create the master page but changing hyperlink (menu) color is being problematic. Is it a good idea to use CSS in asp.net? Anyways, my question is if i have a css element selectedMenu. how would i apply it to menu items on each page. menu again is css generated, used on master page... Please provide help thanx in advance

    C 1 Reply Last reply
    0
    • M mark_me

      Hi, I am having problems with using css in asp.net. I was a php programmer about 3 yrs back, jumped into C# about 2 yrs back but worked with windows applications. Now i wish to work in asp.net. I have good C# knowledge, am using an asp.net book too but this problem, wasn't able to find any help. sorry, if my question is stupid... Actually, i remember in php, using a template on each page and for each page changin colors manually to show selected menu. With asp.net and master pages, i have used CSS to create the master page but changing hyperlink (menu) color is being problematic. Is it a good idea to use CSS in asp.net? Anyways, my question is if i have a css element selectedMenu. how would i apply it to menu items on each page. menu again is css generated, used on master page... Please provide help thanx in advance

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      mark_me wrote:

      Is it a good idea to use CSS in asp.net?

      Absolutely. ASP.NET, like PHP, is an engine for generating HTML, javascript and CSS ( what else could it be ? ). Therefore, it would be worthless if it had no support for a central platform of web development.

      mark_me wrote:

      Anyways, my question is if i have a css element selectedMenu. how would i apply it to menu items on each page. menu again is css generated, used on master page...

      Ultimately, if you're using css and creating a menu, this is a html/general web development issue. There's nothing in ASP.NET that could possibly hope to change how a browser reads css, or what it does with it. So, your best starting point is to look at the script being emitted, and try to work out what's missing, or in the wrong place, or whatever. Then work backwards from there, and work out why the way you're using ASP.NET is not creating the result you expect.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      M 1 Reply Last reply
      0
      • C Christian Graus

        mark_me wrote:

        Is it a good idea to use CSS in asp.net?

        Absolutely. ASP.NET, like PHP, is an engine for generating HTML, javascript and CSS ( what else could it be ? ). Therefore, it would be worthless if it had no support for a central platform of web development.

        mark_me wrote:

        Anyways, my question is if i have a css element selectedMenu. how would i apply it to menu items on each page. menu again is css generated, used on master page...

        Ultimately, if you're using css and creating a menu, this is a html/general web development issue. There's nothing in ASP.NET that could possibly hope to change how a browser reads css, or what it does with it. So, your best starting point is to look at the script being emitted, and try to work out what's missing, or in the wrong place, or whatever. Then work backwards from there, and work out why the way you're using ASP.NET is not creating the result you expect.

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        M Offline
        M Offline
        mark_me
        wrote on last edited by
        #3

        hi, thankyou for replying but i want to re-iterate my question. In php, you would make every page. For home page, you will use css element selectedMenu for homelink, in product page you will use selectedMenu for Product, similarly for pageN you will have PageN set to selectedMenu. That way, a user will know which page he is viewing. Inshort, every page is kinda redesigned in php. In asp.net, you will have one template, the master... with menu in master, you can have multiple pages but how would you set css property to selectedMenu for page Product programmatically, again how would u set it to pageN programatically. Will i have to use page.Load. Again, thanks for replying.

        C 1 Reply Last reply
        0
        • M mark_me

          hi, thankyou for replying but i want to re-iterate my question. In php, you would make every page. For home page, you will use css element selectedMenu for homelink, in product page you will use selectedMenu for Product, similarly for pageN you will have PageN set to selectedMenu. That way, a user will know which page he is viewing. Inshort, every page is kinda redesigned in php. In asp.net, you will have one template, the master... with menu in master, you can have multiple pages but how would you set css property to selectedMenu for page Product programmatically, again how would u set it to pageN programatically. Will i have to use page.Load. Again, thanks for replying.

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          mark_me wrote:

          Will i have to use page.Load.

          Well, plainly not. You can use the prerender event, and that's often a better idea, because it fires after events. What you would do, is write code to change the classes of your menu items, based on what page is selected. The way I'd do this, is write a menu class that uses a session variable to know which item to show as selected, then each page sets the right value. Another reason to use prerender, so you have time to set that value first.

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          M 1 Reply Last reply
          0
          • C Christian Graus

            mark_me wrote:

            Will i have to use page.Load.

            Well, plainly not. You can use the prerender event, and that's often a better idea, because it fires after events. What you would do, is write code to change the classes of your menu items, based on what page is selected. The way I'd do this, is write a menu class that uses a session variable to know which item to show as selected, then each page sets the right value. Another reason to use prerender, so you have time to set that value first.

            Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

            M Offline
            M Offline
            mark_me
            wrote on last edited by
            #5

            Thankyou

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups