[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1473
  • Last Modified:

How to stop page post back when I used image button by javascript in Asp.net 2005?

I have a asp.net 2005 web project which was asp.net 2000 project before. After I converted to 2005 from 2000, somehow page is post back to rebuild the page when I click a image button to open brand new popup window to show something.
I am using clinet javascrip to open new popup window by :
<input type="Image" src="...."  in aspx page.

Button clicked invoked a function at the bottom.

function Opensheet(openURL)
    WHeight = window.screen.availHeight - 150;
      pw = window.open(openURL, "printWindow", "width=800,height=" + WHeight + ",menubar=yes,scrollbars=yes,resizable=yes,left=0,top=60");  

Popup window is working fine but parent page is trying to rebuild page again without URL QueryString value so page got error because there is no value.
How to stop posting back ?
Is it new feature in 2005? required learning curve?

1 Solution
Carl TawnSystems and Integration DeveloperCommented:
Just set the "AutoPostback" property of the ImageButton to false.
Hi young_nacs,

If that doesn't work then use:

<input type="image" src="...." Onclick="Opensheet('someurl');return false;">

The return false will stop it posting back.

Tim Cottee

The image has a property called Autopostback with values true and false. Ity should be set to true now. So as soon as you click  it it is postbacking. Set the property as false and run again.


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now