Issue with showModalDialog in asp.net

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
 
E

Eliyahu Goldin

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
 
G

Guest

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">
 
B

bruce barker

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top