Thursday, November 6, 2008

favicon to your site

Would you like to display your own icon on the browser address bar when visitors view or bookmark your web page?
place the below code in the head tag of page to get the icon.

<link rel="shortcut icon" href="http://path/favicon.ico" >
<link rel="icon" href="http://path/favicon.ico" >

To Genearate favicon to your site click here

Tuesday, November 4, 2008

Fire a button click from any text box when enter key is pressed

If you have more than one button on a form ASP.Net doesn't know which button should be the default button.

With this code you may trigger any button click from any text box when the enter key is pressed.

TextBox.Attributes.Add("onkeydown", "javascript:if((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)){document.getElementById('" & Button.ClientID & "').click();return false;}else return true;")

other way is if you are using panels then you can use the property
"Default Button".