Monday, September 27, 2010

Adding Fav-Icons to websites

Whenever we open a webpage or visit a website we see one icon at the starting in the address bar. That icon is know as "Fav-Icon" or logo/symbol for that company or page. This favicon is useful for recognizing pages, creating bookmarks etc...

we can add this fav-icons easily in webpages. Here are the couple of steps which describes how to adding fav-icons.
At first we have to create the icon images in order to display. You can create using adobe photoshop or in online you can use http://www.favicon.cc/  this website in order to create icon images.
After creating the icon images, place that image in root folder of the pages and within ...tag insert the following code

"link href="flower.ico" rel="shorcut icon" type="image/ico"

and in href give link to icon image.

After this when you run the page, image will display in address bar.

Here we can do this asp.net also. There also we can follow the same procedure, in link tag add the following property

rel="shortcut icon" href="<%=ResolveUrl("~/minto1.ico")%>"

in resolve url link to the image file.
Instead of placing same code in all files you can simply place it in master pages within ...tag. In all pages that will be reflected.

Javascripts in ASP.NET

               In asp.net we use javascript as same as in html. That will work fine. But using inside web user controls , instead of calling textbox and other controls directly, call the control as document.getElementById('<%=txtname.ClientID%>') . This will make that control to fetch correct value. Here in asp.net every object will have client id. Javascript will search for that particular client id in that controls.


No comments:

Post a Comment