Archive for May, 2008

Dynamic favorite icons in Asp.Net

May 15, 2008

My question was just about the same as Christopher Carey’s (and I hope he reads this)

This is the effect I wanted

 I wanted an array of buttons at the top of the page, each with an image. When I opened a page, I wanted it to open in a new tab, and I wanted the favorite icon to be the same as the image used for the button, to make it easy to relate the button to the new page.


Here’s how I did it:

1) in the header section of the master page:

<head runat="server">
<link href="<%=Session("favorite") %>" rel="SHORTCUT ICON" />

2) in the child page onLoad

     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Session("favorite") = "images/users.ico"
        Session("Breadcrumb") = "Customers"
    End Sub