no default button

  • Thread starter Thread starter Peter K
  • Start date Start date
P

Peter K

Hi

I have a web-page with many fields/buttons etc.

How do I "unassign" a default-button? That is I do not want any button to
cause a postback if the enter key is pressed. I have seen many websites
which describe how to assign a default-button, and even how to assign a non
visisble button (but even this causes a postback).

How do I stop a page from having a default button at all?

Thanks,
Peter
 
Peter K said:
How do I stop a page from having a default button at all?

So I suddenly thought of the following:

<asp:Panel ID="NoDefaultButtonPanel" DefaultButton="noneB" runat="server">

<asp:Button ID="noneB" runat="server" style="display:none"
OnClientClick="return false" />

<!-- all my other controls -->

</aspPanel>

Seems to work by adding the OnClientClick - which I think supresses the
postback.

Thanks,
Peter
 
Hi

I have a web-page with many fields/buttons etc.

How do I "unassign" a default-button? That is I do not want any button
to cause a postback if the enter key is pressed. I have seen many
websites which describe how to assign a default-button, and even how
to assign a non visisble button (but even this causes a postback).

How do I stop a page from having a default button at all?

Thanks,
Peter

I see you have an option, but here is a bit more info. It is also
achievable on the entire form with a bit of JavaScript. Test for enter
and return false on the form.

Peace and Grace,

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Back
Top