Issue with showModalDialog in asp.net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a button and on click i am calling a script function to invoke a
dialog argument.
btnPopup.attributes.add("OnClick","showpopup();return false;")

Now the problem is that when i press "enter key" in my page(any where in my
parent page) i get my dialog window.
how to get rid of this. Is there any other thing i need to write.

Thanks in advance.
V Suresh
 
Your popup button just happened to be the first button on the form and, as
such, it became the default one. This means that pressing Enter cause the
same effect as mouse click on it. To disable the effect you can check event
object in javascript. If event.type is not "click", don't show the dialog.

Eliyahu
 
One, that I call, issue with ASP.NET is that by utilizing multiple buttons on
a form , and there is only one submit allowed (posting back to itself), the
enter key will "click" the first button in tab order.
I create mulitple buttons on my forms to process different results so I have
come to grips with disabling the enter key all together until the next
revision of .NET (I thought I heard that this would be addressed).
Using in the head area of each page with multiple buttons:
<Script language=javascript>
document.onkeydown = doKey;

function doKey(e) {
if (event.keyCode==13)return false;
}
</script>
or the MS article discussing a work around:
http://support.microsoft.com/default.aspx?scid=kb;en-us;813822

I'm using showModalDialogs, so make sure you also add this to the header:
<base target="_self">
<meta http-equiv="Pragma" content="no-cache">
 
use a html button, intead of a submit button (asp:button), they do not post
back.

-- bruce (sqlwork.com)


| Hi,
|
| I have a button and on click i am calling a script function to invoke a
| dialog argument.
| btnPopup.attributes.add("OnClick","showpopup();return false;")
|
| Now the problem is that when i press "enter key" in my page(any where in
my
| parent page) i get my dialog window.
| how to get rid of this. Is there any other thing i need to write.
|
| Thanks in advance.
| V Suresh
 
Back
Top