I don't want to postback

J

Jaime

Hi all,

I'm not sure if this is the correct forum, but here goes.

Is there a way to not post back after a button (actually imagebutton) is
clicked?

I have something like:
<asp:ImageButton ID="something" ImageUrl="pic.gfx" Runat="Server"
OnClick="ViewDetails('"+id+"')" />

now, this works fine for opening a new window to display the details of the
selected record, but it also causes a postback on the page and I really
don't need it since nothing has changed on the parent page...

Any help?

thanks
 
G

Guest

Jaime,

The problem arises due to the fact that you are using a imagebutton. I think
for your requirement you should be using a hyperlink (can take imageurl).

set the NavigateUrl to "#"
and add an attribute from code behind using

lnkOpener.Attributes.Add("onclick", "ViewDetails('"+id+"')");

this should prevent the postback and still execute ViewDetails which i
presume calls appropriate aspx page with correct id.

HTH

Regards,

Hermit Dave
http://hdave.blogspot.com
 
S

Steve C. Orr [MVP, MCSD]

Why don't you just use an Image control instead of an ImageButton control?
 
J

Jaime

Thanks for the tip. That worked great. Now I have a different question, is
there a way to keep track of the "parent" or "caller" page so when I'm done
updating data in the detail view I can PostBack on the parent page and get
the updated data?

Thanks
Jaime
 
G

Guest

you can use
window.opener.document.location.reload();
or
window.opener.document.location.href = 'abc.aspx';

can be used to either reload opener or redirect opener to another page

HTH

Regards,

Hermit Dave
http://hdave.blogspot.com
 

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,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top