Blog

Highlighting the CurrentNode in a ASP.Net UL menu

February 18 2009

Another quick snippet again folks. This time I’m using an ASP.NET sitemap provider to populate a repeater that generates an unordered list. The end user wants the current page to be highlighted in the menu, so I’ve set up a class called current-page in the stylesheet which will make this text bold.

Then I add the following to the reapeater item template code.

<li <%# currentPage(Eval("Url"))%>>

After doing that, the final stage is to add the following to the .cs file of the menu user control. This code compares the url output by the SiteMapProvider with the CurrentNode url of the page. If it finds a match, it adds the class to the list item.

protected string currentPage(object tURL)
{
 string cnURL = SiteMapProvider1.Provider.CurrentNode.Url.ToString();
 string cp;
 if (cnURL == tURL.ToString())
 {
   cp = "class=\"current-page\"";
 }
 else
 {
 cp = "";
 }
 return cp;
}

That’s pretty much it! If anyone has a more efficient way of doing this, drop me a line or comment.

Spruce up

January 29 2009

Here’s the new theme for the site folks.

It’s been in development for a while, so I figured I should just get it out there and bug fix as I go along.

In that regard, watch out for falling code and leaky abstractions.

Resolutions 2009

December 31 2008

So as another year closes, it’s time for me to make a list of things to do over the next year.

Main Goals

  • Work on my drawing and 3D skills and build a better portfolio (the awesome new A4 wacom intuos tablet my family bought me should help with that!)
  • Learn guitar (my new fender is another sweet gift from the family)
  • Concentrate on building a better fitness and dietary plan.
  • Update my site more often.

Side goals

  • Take up at least two sports activities in the next year.
  • Read at least one book a month, if not every 2 weeks.
  • Experience more diverse books, films and music.
  • Create an animated short using flash.

I’ve not set anything too difficult this year, hopefully that should make these easier to keep. Anyway, to all those reading, have a great New Year!

Aged ‘Cabs from Museum Window’

November 5 2008

Cabs from Museum window

I’ve been playing around with textures in photoshop, and I’m quite pleased with how this artificially aged photo turned out, the original is on my flickr account as “Cabs from Museum Window“.

Just discovered an unknown competitive streak

About

Photo of James McEwan

Onezom is James McEwan a web designer, developer and illustrator from Edinburgh, Scotland.

I’m contactable via email on or jamesvmcewan on aim or jvmcewan on yim. more…

Download VCard