Stop postback/refresh using a button...

  • Thread starter Thread starter Matthew Wells
  • Start date Start date
M

Matthew Wells

Hello.

I'm trying to use an asp - not html - button without having a postback or a
screen refresh. I've tried turning off "CausesValidation" and
"UseSubmitBehavior" and I still get a screen refresh - which makes me think
I'm doing a postback. I've also tried "return false" in both the onclick
and OnClientClick events. No Luch. Can I use the onclick or OnClientClick
(or something else) to fire a javascritpt function and then stop?

Thanks.

Matthew Wells
(e-mail address removed)
 
I found the answer myself. Make sure UseSubmitBehavior" is True. Do NOT
use OnClick as that requires a server postback. Use OnClientClick and make
sure to return 'false'. It does not have to be in a response to a "confirm"
box, just "return false;". You can do anything in between that doesn't
cause a postback.
 
You are required to be a member to post replies. After logging in or becoming a member, you will be redirected back to this page.



Posted as a reply to:

Stop postback/refresh using a button...

Hello

I'm trying to use an asp - not html - button without having a postback or a
screen refresh. I've tried turning off "CausesValidation" and
"UseSubmitBehavior" and I still get a screen refresh - which makes me think
I'm doing a postback. I've also tried "return false" in both the onclick
and OnClientClick events. No Luch. Can I use the onclick or OnClientClick
(or something else) to fire a javascritpt function and then stop

Thanks

Matthew Well
(e-mail address removed)

EggHeadCafe - Software Developer Portal of Choice
WCF Workflow Services Using External Data Exchange
http://www.eggheadcafe.com/tutorial...a-6dafb17b6d74/wcf-workflow-services-usi.aspx
 
You are required to be a member to post replies. After logging in or
becoming a member, you will be redirected back to this page.



Posted as a reply to:

Stop postback/refresh using a button...

Hello.

I'm trying to use an asp - not html - button without having a postback or
a
screen refresh. I've tried turning off "CausesValidation" and
"UseSubmitBehavior" and I still get a screen refresh - which makes me
think
I'm doing a postback. I've also tried "return false" in both the onclick
and OnClientClick events. No Luch. Can I use the onclick or
OnClientClick
(or something else) to fire a javascritpt function and then stop?

Thanks.

Matthew Wells
(e-mail address removed)

EggHeadCafe - Software Developer Portal of Choice
WCF Workflow Services Using External Data Exchange
http://www.eggheadcafe.com/tutorial...a-6dafb17b6d74/wcf-workflow-services-usi.aspx

the following should work in the aspx to prevent postback.



<asp:Button ID="Button1" runat="server" OnClientClick="return false;"
onclick="Button1_Click" Text="Button" />
 
Back
Top