473,387 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

I don't want to postback

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
Nov 19 '05 #1
4 1592
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

"Jaime" wrote:
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

Nov 19 '05 #2
Why don't you just use an Image control instead of an ImageButton control?

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Jaime" <j@j> wrote in message news:eZ**************@TK2MSFTNGP09.phx.gbl...
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

Nov 19 '05 #3
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

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:73**********************************@microsof t.com...
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

"Jaime" wrote:
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

Nov 19 '05 #4
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

"Jaime" wrote:
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

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:73**********************************@microsof t.com...
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

"Jaime" wrote:
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


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Gaëtan | last post by:
I want to post my form by clicking on a RadioButton but not on clicking on an ImageButton. How to do to execute only the click procedure of the ImageButton and not the postback of my page. Because...
5
by: Matt | last post by:
I always see the term "postback" from ASP book, but I am not sure if I fully understand the meaning. Here's my understanding so far, please correct me if any mistakes. Here's a typical html...
5
by: Matthew Louden | last post by:
I created simple ASP.NET web application to test how AutoPostBack property in a web control works. I set AutoPostBack property to be true of a web control. When I run the application, here's the...
2
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control...
8
by: walesboy | last post by:
greetings - I have a btnSubmit button with a Handles btnSubmit.click which works great if all the user does is click that button. But, if the user ALSO changes a text box on the page (which...
2
by: Wizzard | last post by:
I have a repeater with and imagebutton on a page useing VS2005 ASP.Net 2.0 <asp:Repeater ID="Repeater1" runat="server" > <ItemTemplate> <div> <asp:ImageButton ImageUrl="button.gif"...
11
by: antonyliu2002 | last post by:
I know that this has been asked and answered thousands of times. As a matter of fact, I know that I need to say If Not Page.IsPostBack Then 'Do something End If for things that needs to be...
2
by: Nathan Sokalski | last post by:
I have a DataList in which the ItemTemplate contains two Button controls that use EventBubbling. When I click either of them I receive the following error: Server Error in '/' Application....
2
by: arti | last post by:
In Asp.net form, I have 3 panels. I want a button on top of each panel to hide or display the panel. I am able to do it. But when there is any postback, the page loads with its design time setting-...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.