Friday, September 11, 2009

Setting LinkButton as defaultButton

I have been working with asp:Panel to set a LinkButton as defaultButton. After a few google search I found a method mention as a comment at this page, which works well with IE, Firefox and Chrome.

For your convenience, it's here.
<script type="text/javascript">
//BEGIN Javascript CODE
if (typeof(HTMLAnchorElement) != "undefined" )
{
HTMLAnchorElement.prototype.click = function()
{
window.location = this.href;
}
}
//END Javascript CODE
</script>