Prevent PostBack

J

Jonathan Wood

I have an image button on my page that runs some javascript:

<asp:ImageButton runat="server" id="ImageButton3"
ImageUrl="Graphics/Help.png" AlternateText="Help"
onclientclick="javascript:ShowHelp('help_rent.aspx')" />

ShowHelp() is a function that I create that calls window.open().

It works okay--it pops up a separate help window with content from another
page--but it also refreshes the current page, which I want to prevent.

How do I stop the default behavior?

Jonathan
 
B

bruce barker

onclientclick="ShowHelp('help_rent.aspx');return false;" />

-- bruce (sqlwork.com);
 
C

Cowboy \(Gregory A. Beamer\)

You can have ShowHelp() return false, as well.

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

*************************************************
| Think outside the box!
|
*************************************************
 
J

Jonathan Wood

And I assume you mean to change the call to onclientclick="javascript:return
ShowHelp('help_desc.aspx')"

Thanks.
 
C

Cowboy \(Gregory A. Beamer\)

Pretty much anything that sends back a false will interrupt the postback.

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

*************************************************
| Think outside the box!
|
*************************************************
 

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

Top