Tuesday 8 September 2009

Hallelujah--I've solved it

For about two years I've been trying to get a small snippet of code written to make navigation at my website simple for users, whilst at the same time, simple for me to update the site. I decided three days ago I was going to solve it once and for all.

I immersed myself in 2000 page programming manuals, did google searches on code snippets, & tried different variations of four lines of code over and over. A few minutes ago I finally came up with a code combination which works!! Yeh!

For those who are pragmatically inclined, I was "simply" trying to add "target" to a sitemap node (For some inexplicable reason Microsoft didn't include target). This is how it's done...
  1. In the page where you have a gridview control add a template column thus:


    Note the [ ] bracket around target in Eval("[target]"). That was the solution to solving this puzzle. The square bracket supplies a key, in this case "target" and retrieves its value, in this case "_blank" or nothing.

  2. And the way to add target to the sitemap node is...
    The objNode.Item("target") = "_blank" is where the "Target" property is added to the standard: ID, title, url, & description properties of Microsoft's sitemap node.
And what does all this do? It allows a page to be opened in a new window using a menu derived from the site's sitemap--it's all about mastering the complex to make life simple for website users.