Link to home
Start Free TrialLog in
Avatar of young_nacs
young_nacs

asked on

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

Hi,
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");  
      pw.focus();
}

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?

thanks,
Young
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Avatar of manojkumarps
manojkumarps



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.

Manoj