473,806 Members | 2,845 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

prevent ImageButton to postback

I would like to prevent an ImageButton to make a postback, since I added its
action in Javascript. But I don't want to remove runat="server", since
without this I cannot attach the JavaScript (build dynamically in code
behind) to the button.
Is there a way to do this ?
Nov 19 '05 #1
3 1842
How about using an <asp:image instead of an imagebutton?

Ray at work

"Carlo Marchesoni" <Ca************ *@discussions.m icrosoft.com> wrote in
message news:1E******** *************** ***********@mic rosoft.com...
I would like to prevent an ImageButton to make a postback, since I added
its
action in Javascript. But I don't want to remove runat="server", since
without this I cannot attach the JavaScript (build dynamically in code
behind) to the button.
Is there a way to do this ?

Nov 19 '05 #2
Set its PostbackUrl property to "javascript:voi d(0);"

"Carlo Marchesoni" <Ca************ *@discussions.m icrosoft.com> wrote in
message news:1E******** *************** ***********@mic rosoft.com...
I would like to prevent an ImageButton to make a postback, since I added its
action in Javascript. But I don't want to remove runat="server", since
without this I cannot attach the JavaScript (build dynamically in code
behind) to the button.
Is there a way to do this ?
Nov 19 '05 #3
Another way is at the end of your javascript add: return false;

like this: your javascript ends here; return false;

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Siva M" <sh******@onlin e.excite.com> wrote in message
news:eg******** ******@TK2MSFTN GP12.phx.gbl...
Set its PostbackUrl property to "javascript:voi d(0);"

"Carlo Marchesoni" <Ca************ *@discussions.m icrosoft.com> wrote in
message news:1E******** *************** ***********@mic rosoft.com...
I would like to prevent an ImageButton to make a postback, since I added
its
action in Javascript. But I don't want to remove runat="server", since
without this I cannot attach the JavaScript (build dynamically in code
behind) to the button.
Is there a way to do this ?

Nov 19 '05 #4

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

Similar topics

1
1786
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 on the postback of my page I want to test the request.form of my RadioButton. I try to change the CausesValidation property of the ImageButton but it doesn't work better. Thanks for your help.
1
4750
by: Sue | last post by:
For performance purposes, I am using client-side scripts to show-hide (via css display: hide, display: block) several rows of a table depending on which imagebutton is clicked. Because of workplace standards I'm using vbscript on the client-side. The sub called hides the rows without problems, but an autopostback from the imagebutton causes the display property to reset and the rows reappear. Does anyone know a simple way to disable the...
3
12135
by: Marcelo | last post by:
Hi, I have an ImageButton which, when clicked, redirects to another page. The problem is that page A (where the ImageButton is located) has lots of information, but when I click the button, it redraws the header of the table, which we'd like not to happen. My question is: Is there any way of prevent this postback? Or, is there any way of, in Page_Load, detect that it is happening due the click on the button, so I could redirect it...
2
3644
by: Chuck Hartman | last post by:
I've been trying to add an ImageButton object to a Calendar table cell, but so far I am unable to handle the Command event from that button in my form's code behind. Below is an example of what I am trying to do. The ImageButton that is on the form handles its Command event just fine, but the ImageButton that is added to the cell does not handle the event. Am I doing something wrong, or is not possible to add server controls to a calendar...
5
6178
by: J McD | last post by:
Hi I have a DataGrid with an ImageButton column. When I click on an imagebutton I get a postback but it doesn't run the OnImgBtnClick method. I can actually comment out the line where I add this Click event to the ImageButton Column and it makes no difference, I still get a postback. This is driving me crazy...something seems to be causing an OnClick postback and it isn't my Click event I've included the code below....any help will be...
1
3354
by: Henke | last post by:
Hello, I have one ImageButton controls which I initialize in Page_Load and declare on class level. ImageButton save = new ImageButton(); save.ImageUrl = "save.gif" save.Click += new ImageClickEventHandler(this.save_click); This ImageButton is added to a dynamic table which is also
6
22137
by: ruca | last post by:
Hi gurus, I have a imagebutton in my WebForm, and I want that when I click (mouse down) on her the imagebutton change image and when I "unclick" (mouse up) change to the original image. Basically I want to know how can I have the mousedown and mouseup buttons events. I think that I have to do this in JavaScript. Can you help me on this?
3
2817
by: Benjamin Gavin | last post by:
Hi all, I recently stumbled upon a bug in the ASP.NET framework handling of ImageButton based postbacks. The issues derives from the fact that IE and Mozilla handle the case of a missing image file differently. In both cases, the setup for the problem is: 1. Create a form with an ImageButton whose ImageURL is invalid, specify an AlternateText value 2. Submit the form through that ImageButton
6
3830
by: Jonathan Wood | last post by:
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.
0
10618
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10371
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4329
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3850
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.