Sanjay Uttam

July 2008 Entries

Default Button Workaround for imagebuttons & linkbuttons

UPDATE: If you're looking for the solution that will work in FireFox & IE...Go here

Okay, I admit, this is yet another post so I know where to go in 3 months when I totally forget this day. 

Long story short: I was trying to use the DefaultButton property on a panel in order to get a button clicked by default when a user hits enter on my search form.  I was using an ImageButton, and surprise! That won't freakin' work!  Seriously...try it. 

I came across a post on here ( http://bytes.com/forum/thread288545.html ) from S. Justin Gengo. With a link to his site.... http://www.aboutfortunate.com/Code-Repository.aspx?entryid=14

And booya, his simple JS code works perfectly in IE6/7 & FF. 

Good day, sir.

ps - Thank you Justin

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

Get BehaviorID from Master Page

You can definitely find this information elsewhere

But...I'm going to put it here right so I know where to go next time :)

I have/had a situation where I had a modal control on my master page - it's what I'm using for a user to log into my application.  I have many pages that need to call this - but I needed a way to call the show() method on my modal pop-up, from javascript.  Here is the solution...

  var modalOnmaster = $find("ctlModalPopupBehavior");
  modalOnmaster.show();

Thank you Brett.