Stop postback/refresh using a button...

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)
 
M

Matthew Wells

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.
 
P

Paul Ireland

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
 
R

Ralph

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

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top